MYSQL启用日志和查看日志

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

MYSQL启用日志,和查看日志mysql有以下几种日志:错误日志:-log-err查询日志:-log慢查询日志:-log-slow-queries更新日志:-log-update二进制日志:-log-bin是否启用了日志mysqlshowvariableslike'log_%';怎样知道当前的日志mysqlshowmasterstatus;顯示二進制日志數目mysqlshowmasterlogs;看二进制日志文件用mysqlbinlogshellmysqlbinlogmail-bin.000001或者shellmysqlbinlogmail-bin.000001|tail在配置文件中指定log的輸出位置.Windows:Windows的配置文件为my.ini,一般在MySQL的安装目录下或者c:\Windows下。Linux:Linux的配置文件为my.cnf,一般在/etc下。在linux下:Sql代码1.#在[mysqld]中輸入2.#log3.log-error=/usr/local/mysql/log/error.log4.log=/usr/local/mysql/log/mysql.log5.long_query_time=26.log-slow-queries=/usr/local/mysql/log/slowquery.log#在[mysqld]中輸入#loglog-error=/usr/local/mysql/log/error.loglog=/usr/local/mysql/log/mysql.loglong_query_time=2log-slow-queries=/usr/local/mysql/log/slowquery.logwindows下:Sql代码1.#在[mysqld]中輸入2.#log3.log-error=E:/PROGRA~1/EASYPH~1.0B1/mysql/logs/error.log4.log=E:/PROGRA~1/EASYPH~1.0B1/mysql/logs/mysql.log5.long_query_time=26.log-slow-queries=E:/PROGRA~1/EASYPH~1.0B1/mysql/logs/slowquery.log#在[mysqld]中輸入#loglog-error=E:/PROGRA~1/EASYPH~1.0B1/mysql/logs/error.loglog=E:/PROGRA~1/EASYPH~1.0B1/mysql/logs/mysql.loglong_query_time=2log-slow-queries=E:/PROGRA~1/EASYPH~1.0B1/mysql/logs/slowquery.log开启慢查询long_query_time=2--是指执行超过多久的sql会被log下来,这里是2秒log-slow-queries=/usr/local/mysql/log/slowquery.log--将查询返回较慢的语句进行记录log-queries-not-using-indexes=nouseindex.log--就是字面意思,log下来没有使用索引的querylog=mylog.log--对所有执行语句进行记录

1 / 2
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功