I am running a Rails app so now I am trying to remote connect to mysql and I am getting this error Could not connect: Lost connection to MySQL server at 'reading initial communication packet', system error: 0
views:
4419answers:
7"Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0" is the client side error message. Do you have access to the server logs, both the mysqld logs and syslog?
check from that host
shell> telnet IP 3306
If MySQL is up and reachable you'll see mysql version in telnet output. Otherwise check firewall, etc until telnet succeeds.
Then I advice you first connect with native mysql client to exclude Rails from problem aria.
Thank you guys for your effort, I have found the solution, I was suppose to set Remote Connection to MySQLhere is the link for someone who got the same error http://benrobb.com/2007/01/15/howto-remote-root-access-to-mysql/
You might want to check your /etc/hosts.deny where:
ALL: ALL: DENY
or
mysqld: ALL: DENY
is your enemy.
You need to edit your mysql Configuration file, by default the bind-adress
is set to 127.0.0.1
.
Open: /etc/mysql/my.cnf
Change the bind-adress
to the ip you are going to use to connect yoursef to the database server.
Enable remote access
The MySQL server does not listen on the TCP port 3306 by default. To allow (remote) TCP connections, comment the following line in /etc/mysql/my.cnf:
skip-networking
Remember to edit /etc/hosts.allow by adding the following lines:
mysqld: ALL : ALLOW
mysqld-max: ALL : ALLOW