Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I had two MySQL servers running ( and Now I get this strange error: mysql_connect(): Lost connection to MySQL server at 'reading initial communication packet' I can connect with localhost:3307, but there aren't any tables/databases. I'm sure /etc/my.cnf is right:

mysqld     = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
user       = root
password   = ***

port       = 3306
socket   = /var/run/mysql/mysql.sock

port       = 3307
socket   = /var/run/mysql/mysql2.sock

What can I do now? How can I restart the MySQL server? How can I make sure all tables still exists?

share|improve this question
which System Error code do you get? – racyclist May 31 '11 at 15:51
This one: 111. I did a mysqld_multi restart, that worked, but I couldn't find my own tables :(. Where are they? – Kevin May 31 '11 at 15:52
I'm getting a headache, when I try the following in SSH, I get an error that it doesn't work, but it does in PHP??? root@vps8202:~# mysql -h -p 3307 -u root Enter password: ERROR 2003 (HY000): Can't connect to MySQL server on '' – Kevin May 31 '11 at 16:01
-p is for password -P is for port. Try mysql -h -p -P 3307 – racyclist May 31 '11 at 16:14
Thanx, when I do SHOW DATABASES, it doesn't show the ones I created. (just mysql, phpmyadmin, information_schema and test). Where are my (old) databases? How can I find them? – Kevin May 31 '11 at 16:16
up vote 0 down vote accepted

You didn't specify the datadir for each of your mysqld instances. E.g.:

port = 3306
socket = /var/run/mysql/mysql.sock
datadir = /var/lib/mysql

Your question is a few months old, I sure hope you figured it out.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.