安装
yum -y install mariadb mariadb-server
启动
systemctl start mariadb
开机启动
systemctl enable mariadb
配置
mysql_secure_installation
这个操作主要是设置root密码, 默认root密码为空
设置字符集
/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
重起服务
systemctl restart mariadb
查看
mysql -uroot -p
show variables like "%character%";
show variables like "%collation%";
创建用户,分配权限
create user username IDENTIFIED by 'password';
grant all on db.table to username
网友评论