mysql跟踪执行的sql语句

修改my.cnf配置文件

/usr/local/mysql/bin/mysql --verbose --help | grep -A 1 'Default options'
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf

修改/etc/my.cnf,找到[mysqld],在下面添加:
general_log_file = "E:/data/mysql.log" slow_query_log = 1

修改完后,记得重启mysql服务哦

不修改配置实现,通过开启服务指定参数实现

[root@iZwz9ga7ceehy3fbxvmmtbZ ~]# ps -ef|grep mysql
kill -9 1613
nohup /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/home/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=root --log-error=/home/data/mysql/localhost.localdomain.err --general-log=1 --general-log-file=/tmp/mysql.log --pid-file=/home/data/mysql/localhost.localdomain.pid --socket=/tmp/mysql.sock --port=3306 &

猜你喜欢

转载自www.cnblogs.com/hnhycnlc888/p/9300898.html
今日推荐