向mysql配置文件中添加日志配置

2019-12-18 18:04:36 浏览数 (1)

[client]

port = 3306

socket = usr/local/lnmp/mysql-5.7.21/mysql.sock

[mysqld]

basedir = /usr/local/lnmp/mysql-5.7.21

datadir = /usr/local/lnmp/mysql-5.7.21/data

port = 3306

server_id = 1

socket = /usr/local/lnmp/mysql-5.7.21/mysql.sock

#二进制日志目录

log-bin = /usr/local/lnmp/mysql-5.7.21/mysql-bin

#自动删除过期日志的天数

expire_logs_days = 10

#限制单个文件大小

max_binlog_size = 100M

#查询日志

general_log = 1

#查询日志文件位置

general_log_file = /usr/local/lnmp/mysql-5.7.21/query.log

#慢查询日志

slow_query_log = 1

#慢日志文件位置

slow_query_log_file = /usr/local/lnmp/mysql-5.7.21/slow-query.log

#超过2秒记录

long-query_time = 2

#错误日志

log-error = /usr/local/lnmp/mysql-5.7.21/error.log

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

0 人点赞