安裝
yum -y install mariadb mariadb-server
啟動
systemctl start mariadb
開機啟動
systemctl enable mariadb
配置
mysql_secure_installation
這個操作主要是設(shè)置root密碼, 默認(rèn)root密碼為空
設(shè)置字符集
/etc/my.cnf 文件
[mysqld]
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
/etc/my.cnf.d/client.cnf文件
[client]
default-character-set=utf8
/etc/my.cnf.d/mysql-clients.cnf文件
[mysql]
default-character-set=utf8
重起服務(wù)
systemctl restart mariadb
查看
mysql -uroot -p
show variables like "%character%";
show variables like "%collation%";
創(chuàng)建用戶打月,分配權(quán)限
create user username IDENTIFIED by 'password';
grant all on db.table to username