启动Mariadb
前提需安装mariadb-server
- 安装mariadb-server
yum install -y mariadb-server
- 启动服务
systemctl start mariadb.service
- 添加到开机启动
systemctl enable mariadb.service
- 安全设置,以及修改数据库管理员密码
mysql_secure_installation
- 启动MariaDB
- 正常启动
- systemctl start mariadb
- service mariadb start
- 设置开机启动
- systemctl enable mariadb
- chkconfig mariadb on
配置MariaDB的字符集
- 设置客户端:
vim /etc/my.cnf.d/mysql-clients.cnf
[mysql]
default-character-set=utf8
- 设置服务端:
vim /etc/my.cnf.d/server.cnf
[mysqld]
init_connect='SET collation_connection = utf8_general_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_general_ci
skip-character-set-client-handshake
[开启慢查询]
slow_query_log = ON
slow_query_log_file = /usr/local/mysql/data/slow.log
long_query_time = 1