1.安装Mariadb
yum install mariadb mariadb-server mariadb-devel
2.设置 root 密码
#设置root 密码 mysqladmin -u root password "88888888" #修改root 密码 mysqladmin -u root -p password 66666666
3.修改编码
在my.cnf下边添加下边内容 (/etc/my.cnf 或者 /etc/mysql/my.cnf)
[client] ... default-character-set=utf8 ... [mysql] ... default-character-set=utf8 ... [mysqld] ... collation-server = utf8_unicode_ci init-connect='SET NAMES utf8' character-set-server = utf8 ...
4.添加远程用户
#本地登录root mysql -u root -p #输入密码 #添加用户 #GRANT ALL PRIVILEGES ON *.* TO '[0]'@'[1]' IDENTIFIED BY '[2]' WITH GRANT OPTION #[0]要登陆的用户名 #[1]限制登陆的ip如果为%允许所有ip登陆 #[2]登陆密码 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY ‘8888888' WITH GRANT OPTION
5.注意打开firewall端口3306
firewall-cmd --zone=public --add-port=3306/tcp --permanent