在mysql的安装目录下,打开my.ini,在后面加上上面的参数,保存后重启mysql服务就行了。 例如: #Enter a name for the error log file. Otherwise a default name will be used. log-error=err.log #Enter a name for the query log file. Otherwise a default name will be used. #log= #Enter a name for the slow query log file. Otherwise a default name will be used. #log-slow-queries= #Enter a name for the update log file. Otherwise a default name will be used. #log-update= #Enter a name for the binary log. Otherwise a default name will be used. #log-bin= 上面只开启了错误日志,要开其他的日志就把前面的“#”去掉。long_query_time =1 --是指执行超过多久的sql会被log下来,这里是1秒log-slow-queries=slowqueris.log --将查询返回较慢的语句进行记录log-queries-not-using-indexes = nouseindex.log --就是字面意思,log下来没有使用索引的querylog=mylog.log --对所有执行语句进行记录log-error=log-error.log log=log-query.log log-queries-not-using-indexes log-warnings=2 log-slow-queries=log-slow-query.log log-update=log-update.log long_query_time=2
不指定就是使用默认的文件名啊,注释里说的: #Enter a name for the binary log. Otherwise a default name will be used. 你看,我的日志目录都能看到日志文件: │ ibdata1 │ ib_logfile0 │ ib_logfile1 │ SZPC1224-bin.000001 │ SZPC1224-bin.000002 │ SZPC1224-bin.000003 │ SZPC1224-bin.index │ SZPC1224-slow.log │ SZPC1224.err │ SZPC1224.log │ SZPC1224.pid mysql administrator界面上的server logs功能就是用不了,其实my.ini使用默认配置时,就能看到日志文件
你是怎样 配置的,要在MY。INI(CNF)中设置
[client]
port=3306
[mysql]
default-character-set=utf8
[mysqld]
port=3306
basedir="C:/Program Files (x86)/MySQL/MySQL Server 5.1/"
datadir="C:/ProgramData/MySQL/MySQL Server 5.1/Data/"
default-character-set=utf8
default-storage-engine=INNODB
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
max_connections=100
query_cache_size=0
table_cache=256
tmp_table_size=34M
thread_cache_size=8
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=68M
key_buffer_size=55M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=256K
innodb_additional_mem_pool_size=3M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=2M
innodb_buffer_pool_size=106M
innodb_log_file_size=53M
innodb_thread_concurrency=10
log=
错误日志: -log-err
查询日志: -log
慢查询日志: -log-slow-queries
更新日志: -log-update
二进制日志: -log-bin
在mysql的安装目录下,打开my.ini,在后面加上上面的参数,保存后重启mysql服务就行了。
例如:
#Enter a name for the error log file. Otherwise a default name will be used.
log-error=err.log
#Enter a name for the query log file. Otherwise a default name will be used.
#log=
#Enter a name for the slow query log file. Otherwise a default name will be used.
#log-slow-queries=
#Enter a name for the update log file. Otherwise a default name will be used.
#log-update=
#Enter a name for the binary log. Otherwise a default name will be used.
#log-bin=
上面只开启了错误日志,要开其他的日志就把前面的“#”去掉。long_query_time =1 --是指执行超过多久的sql会被log下来,这里是1秒log-slow-queries=slowqueris.log --将查询返回较慢的语句进行记录log-queries-not-using-indexes = nouseindex.log --就是字面意思,log下来没有使用索引的querylog=mylog.log --对所有执行语句进行记录log-error=log-error.log
log=log-query.log
log-queries-not-using-indexes
log-warnings=2
log-slow-queries=log-slow-query.log
log-update=log-update.log
long_query_time=2
log-error=
log=
log-slow-queries=
log-update=
log-bin=
#Enter a name for the binary log. Otherwise a default name will be used.
你看,我的日志目录都能看到日志文件:
│ ibdata1
│ ib_logfile0
│ ib_logfile1
│ SZPC1224-bin.000001
│ SZPC1224-bin.000002
│ SZPC1224-bin.000003
│ SZPC1224-bin.index
│ SZPC1224-slow.log
│ SZPC1224.err
│ SZPC1224.log
│ SZPC1224.pid
mysql administrator界面上的server logs功能就是用不了,其实my.ini使用默认配置时,就能看到日志文件