0

我正在使用 mysql 5.5.32。下面是我的配置文件(my.cnf)...

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd

innodb_file_per_table=1
skip-name-resolve
innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend

log-error=/var/log/mysql/mysql_error.log
long_query_time=1
slow_query_log=1
log-warnings=2
slow-query-log-file=/var/log/mysql/log-slow-queries.log

#starting
#old_passwords=1

#log-bin
#binlog-do-db=<database name>  # input the database which should be replicated
#binlog-ignore-db=mysql            # input the database that should be ignored for replication
#binlog-ignore-db=test


server-id=1
#ending

open_files_limit= 2000
thread_cache_size = 64

query_cache_limit=400M
query_cache_size = 400M
query_cache_type=1
[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
#log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

当我重新启动 mysql 时,我很快就进入了 mysql 控制台。一段时间后,当我尝试进入 mysql 控制台时,大约需要 15-20 秒。

我使用命令show processlist来检查查询,但 mysql 服务器上没有负载。

为什么要花太多时间?如何跟踪错误是什么?

4

1 回答 1

0

使用这句话log-slow-queries=/var/log/mysql/log-slow-queries.log而不是slow-query-log-file=/var/log/mysql/log-slow-queries.log我认为这是您在日志文件中看不到任何内容的问题

确保你有文件

touch /var/log/mysql/log-slow-queries.log
chown mysql.mysql -R /var/log/mysql

我从这里得到这个想法:http: //dev.mysql.com/doc/refman/5.1/en/slow-query-log.html,所以看看有用的东西

于 2013-09-09T09:02:11.273 回答