Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I had two MySQL servers running (127.0.0.1:3306 and 127.0.0.1:3307). 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_multi]
mysqld     = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
user       = root
password   = ***

[mysqld]
port       = 3306
socket   = /var/run/mysql/mysql.sock

[mysqld2]
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 127.0.0.1 -p 3307 -u root Enter password: ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' –  Kevin May 31 '11 at 16:01
    
-p is for password -P is for port. Try mysql -h 127.0.0.1 -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

1 Answer 1

up vote 0 down vote accepted

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

[mysqld]
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

 
discard

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.