美文网首页
centos MariaDB安装

centos MariaDB安装

作者: 我实在没钱 | 来源:发表于2019-05-31 11:37 被阅读0次

安装

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

相关文章

网友评论

      本文标题:centos MariaDB安装

      本文链接:https://www.haomeiwen.com/subject/mkcwtctx.html