安装步骤
安装
1 | yum -y install mariadb mariadb-server |
启动
1 | systemctl start mariadb |
开机启动
1 | systemctl enable mariadb |
配置安全策略
1 | $ mysql_secure_installation |
登陆
1 | mysql -uroot -p |
配置MariaDB的字符集
文件/etc/my.cnf
1 | $ vim /etc/my.cnf |
文件/etc/my.cnf.d/client.cnf
1 | $ vim /etc/my.cnf.d/client.cnf |
文件/etc/my.cnf.d/mysql-clients.cnf
1 | $vim /etc/my.cnf.d/mysql-clients.cnf |
全部配置完成,重启mariadb
1 | systemctl restart mariadb |
进入MariaDB查看字符集
1 | mysql> show variables like "%character%";show variables like "%collation%"; |
添加用户、配置权限
创建用户
1 | mysql>create user username@localhost identified by 'password'; |
直接创建用户并授权的命令
1 | mysql>grant all on *.* to username@localhost indentified by 'password'; |
授予外网登陆权限
1 | mysql>grant all privileges on *.* to username@'%' identified by 'password'; |
授予权限并且可以授权
1 | mysql>grant all privileges on *.* to username@'hostname' identified by 'password' with grant option; |
只授予部分权限
1 | 把其中all privileges或者all改为select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file; |