Home > Database > Mysql Tutorial > mysql记录查询日志的参数配置_MySQL

mysql记录查询日志的参数配置_MySQL

WBOY
Release: 2016-06-01 13:36:31
Original
835 people have browsed it

bitsCN.com

mysql记录查询日志的参数配置

 

Mysql 提供了一整套日志记录的配置项,只不过很多默认是关闭的,曾疑惑mysql为什么没有像SQL Server 那样的查询监听。后经过查找资料,发现Mysql 也可以实现记录查询的SQL。

方法是修改 my.cnf 配置文件(windows 是my.ini)

 

在[mysqld] 节点下增加以下配置项,即可。

 

general-log = 1

 

log = /usr/local/mysql/general-log.log

 

-----------------------------------

当然,此配置适合程序员调试程序性能,在生产环境中不建议开启。

 

另附:慢查询日志,配置参考:

 

slow_query_log = 1

long_query_time=2

slow_query_log_file = /usr/local/mysql/mysql-slow.log
 

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template