我有一个 MySQL 5.0.75 服务器在我的 Linux 笔记本上运行,我想从本地网络中的另一台机器连接到它。
此连接需要 5-6 秒:
mysql -h 172.22.65.101 -u myuser -p123
ping MySQL 主机:
PING 172.22.65.101 (172.22.65.101) 56(84) bytes of data.
64 bytes from 172.22.65.101: icmp_seq=1 ttl=64 time=0.799 ms
64 bytes from 172.22.65.101: icmp_seq=2 ttl=64 time=0.000 ms
64 bytes from 172.22.65.101: icmp_seq=3 ttl=64 time=6.43 ms
64 bytes from 172.22.65.101: icmp_seq=4 ttl=64 time=0.000 ms
64 bytes from 172.22.65.101: icmp_seq=5 ttl=64 time=3.81 ms
64 bytes from 172.22.65.101: icmp_seq=6 ttl=64 time=0.706 ms
^C
--- 172.22.65.101 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5027ms
rtt min/avg/max/mdev = 0.000/1.959/6.437/2.383 ms
有任何想法吗?当我使用 SHOW PROCESSLIST 监控连接时;在 MySQL 主机上,我可以看到命令是“connect”,用户是“unauthenticated user”。这一直持续到建立连接。(然后用户显示为“myuser”,命令为“sleep”)
我是一名开发人员,需要您就如何找到瓶颈提出建议!
我在主机上的 my.cnf:
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 128K
thread_cache_size = 8
myisam-recover = BACKUP
query_cache_limit = 1M
query_cache_size = 16M
expire_logs_days = 10
max_binlog_size = 100M
skip-federated
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[isamchk]
key_buffer = 16M
客户:
mysql Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (i486) using readline 5.2
服务器:
mysql Ver 14.12 Distrib 5.0.75, for debian-linux-gnu (i486) using readline 5.2