点击在我的博客 xuxusheng.com 中查看,有更好的排版哦~
一开始觉的 ubuntu 用的爽,apt+ppa 简单又方便,用着用着又觉得 centos 好像在其他方面更爽一点,其实具体有啥差异自己也说不太上来,还是新手水平,慢慢熟练centos的使用。
mariadb
是由开源社区维护,拉出的一个mysql
分支。目的在于避开甲骨文公司收购mysql后,潜在的闭源风险。
安装 mariadb
sudo yum -vy install mariadb-server mariadb mariadb-devel
yum
会自动进行安装,稍后会提示 Complete
管理 mariadb
systemctl enable mariadb # 设置成开机启动
systemctl start mariadb # 启动 mariadb
systemctl stop mariadb # 关闭 mariadb
systemctl restart mariadb # 重启 mariadb
默认使用 mysql -u root -p
即可进入数据库界面。
配置 mariadb
mysql> grant all privileges on *.* to root@'localhost' identified by 'passwd';
// 将默认的 root 用户设置成 localhost,这样就只能从本机进行访问了。
// privileges 可以省略,*.* 表示所有数据库的所有表
mysql> create user 'username'@'%' identified by 'passwd';
// 或者
mysql> grant all privileges on *.* to 'username'@'%' identified by 'passwd';
// 创建新用户,% 表示匹配所有的host
最后使用 flush privileges
命令刷新生效。
Tips:
show grants for username
:查看某个用户的权限。