Can't connect to local MySQL server through socket
- by Martin
I was trying to tune the performance of a running mysql-server by running this command:
mysqld_safe --key_buffer_size=64M --table_cache=256 --sort_buffer_size=4M --read_buffer_size=1M &
After this i'm unable to connect mysql from the server where mysql is running. I get this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
However, luckily i can still connect to mysql remotely. So all my webservers still have access to mysql and are running without any problems. Because of this though i don't want to try to restart the mysql server since that will probably mess everything up.
Now i know that mysqld_safe is starting the mysql-server, and since the mysql server was already running i guess it's some kind of problem with two mysql servers running and listening to the same port.
Is there some way to solve this problem without restarting the initial mysql server?
UPDATE:
This is what ps xa | grep "mysql" says:
11672 ? S 0:00 /bin/sh /usr/bin/mysqld_safe
11780 ? Sl 175:04 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306
11781 ? S 0:00 logger -t mysqld -p daemon.error
12432 pts/0 R+ 0:00 grep mysql