介绍
使用yum安装mariadb,方便快捷。
安装
安装并启动
1 2 3 4 5
| yum install mariadb-server
systemctl start mariadb
systemctl enable mariadb
|
初始化
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| mysql_secure_installation
Enter current password for root (enter for none):
Set root password? [Y/n]
New password:
Re-enter new password:
Remove anonymous users? [Y/n]
Disallow root login remotely? [Y/n]
Remove test database and access to it? [Y/n]
Reload privilege tables now? [Y/n]
|
登录
修改字符集
vim /etc/my.cnf
在 [mysqld] 标签下添加
1 2 3 4 5
| init_connect='SET collation_connection = utf8_unicode_ci' init_connect='SET NAMES utf8' character-set-server=utf8 collation-server=utf8_unicode_ci skip-character-set-client-handshake
|
vim /etc/my.cnf.d/client.cnf
在 [client] 标签下添加
1
| default-character-set=utf8
|
vim /etc/my.cnf.d/mysql-clients.cnf
在 [mysql] 标签下添加
1
| default-character-set=utf8
|
重启
1
| systemctl restart mariadb
|
修改远程登录权限
1 2 3
| MariaDB [(none)]> grant all privileges on *.* to 'root'@'%' identified by '123456Aa';
MariaDB [(none)]> flush privileges;
|