各高手,本人是新安装的Mysql 5.6,以下是my.ini文件中关于log的内容,问一下怎么修改本文件的内容,可以开启Mysql数据库的各日志呢?例如查询日志、错误日志等?
The default character set that will be used when a new schema or table is
# created and no character set is defined
character-set-server=utf8
# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB
# Set the SQL mode to strict
sql-mode=”STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”
# Enable Windows Authentication
# plugin-load=authentication_windows.dll
# General and Slow logging.
log-output=FILE
general-log=0
general_log_file=”USER-20150908VK.log”
slow-query-log=1
slow_query_log_file=”USER-20150908VK-slow.log”
long_query_time=10
# Binary Logging.
# log-bin
# Error Logging.
log-error=”USER-20150908VK.err”
# Server Id.
server-id=1
# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.
max_connections=151
The default character set that will be used when a new schema or table is
# created and no character set is defined
character-set-server=utf8
# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB
# Set the SQL mode to strict
sql-mode=”STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”
# Enable Windows Authentication
# plugin-load=authentication_windows.dll
# General and Slow logging.
log-output=FILE
general-log=0
general_log_file=”USER-20150908VK.log”
slow-query-log=1
slow_query_log_file=”USER-20150908VK-slow.log”
long_query_time=10
# Binary Logging.
# log-bin
# Error Logging.
log-error=”USER-20150908VK.err”
# Server Id.
server-id=1
# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.
max_connections=151
解决方案
15
下载一下MYSQL官方免费手册,然后搜索下面段落,有详细介绍和具体步骤。
25
不建议开启全部的日志,看你的实际需要,一般 慢日志、错误日志、二进制日志 都应该开启:
这里是通用日志 和 慢日志,通用日志没有开启,原因是假如开启的话,全部语句都会记录下来,日志量超大
而慢日志是默认开启的
# General and Slow logging.
log-output=FILE
general-log=0
general_log_file=”USER-20150908VK.log”
slow-query-log=1
slow_query_log_file=”USER-20150908VK-slow.log”
long_query_time=10
二进制日志,很有用,可以用来恢复数据库、做主从复制等,下面就是开启的方法,开启后会有这样的文件:mysql.000001
# Binary Logging.
log-bin=mysql
错误日志肯定要开启,记录了各种错误信息,很重要
# Error Logging.
log-error=”USER-20150908VK.err”
这里是通用日志 和 慢日志,通用日志没有开启,原因是假如开启的话,全部语句都会记录下来,日志量超大
而慢日志是默认开启的
# General and Slow logging.
log-output=FILE
general-log=0
general_log_file=”USER-20150908VK.log”
slow-query-log=1
slow_query_log_file=”USER-20150908VK-slow.log”
long_query_time=10
二进制日志,很有用,可以用来恢复数据库、做主从复制等,下面就是开启的方法,开启后会有这样的文件:mysql.000001
# Binary Logging.
log-bin=mysql
错误日志肯定要开启,记录了各种错误信息,很重要
# Error Logging.
log-error=”USER-20150908VK.err”