1. 创建日志存放目录:
mkdir /var/log/mysql && chown mysql:mysql /var/log/mysql
2.修改Mysql配置日志:
vi /etc/my.cnf.d/server.cnf
log_output=FILE
general_log = 1
general_log_file = /var/log/mysql/general.log
slow_query_log=1
long_query_time=2
slow_query_log_file=/var/log/mysql/slow.log
log-bin=mysql-bin
log-error=/var/log/mysql/error.log
character-set-server=utf8
vi /etc/my.cnf.d/client.cnf
default-character-set=utf8