gpt4 book ai didi

Mysql 连接花费太多时间

转载 作者:行者123 更新时间:2023-11-30 01:19:37 24 4
gpt4 key购买 nike

我使用的是 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服务器上没有负载。

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

最佳答案

使用这句话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 ,所以看看有什么有用的东西

关于Mysql 连接花费太多时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18694188/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com