CentOS下安装
yum -y install mariadb mariadb-server
开启
systemctl start mariadb.service
关闭
systemctl stop mariadb.service
mysqladmin -uroot -p shutdown
重新启动
systemctl restart mariadb
设置服务自启动
systemctl enable mariadb.service
连接
mysql -uroot -p
修改字符集
vi /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.cnfvi /etc/my.cnf.d/client.cnf
在[client]中添加
default-character-set=utf8
文件/etc/my.cnf.d/mysql-clients.cnfvi /etc/my.cnf.d/mysql-clients.cnf
在[mysql]中添加
default-character-set=utf8
查看字符集
show variables like "%character%";show variables like "%collation%";
允许root用户在任何机器上登陆:
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
FLUSH PRIVILEGES