Lost connection to Mysql server at 'reading initial communication packet', system error:0

mariadb-logo

Lost connection to Mysql server at ‘reading initial communication packet’, system error:0

This error appears when you try to connect to a MySQL or MariaDB database and it is unavailable. The fix depends on your situation:

If you have MySQL/MariaDB installed on the server where you are trying to connect

  • Edit the configuration file located on /etc/mysql/my.cnf
  • Set: bind_address = 0.0.0.0
  • Restart: service mysql restart

If the server is just a proxy, like a HAProxy server:

  • Remember to grant access permissions on all database servers, check my guide about it on how to deploy a MariaDb Cluster: INSERT INTO user (Host,User) values ('11.11.11.11','haproxy'); FLUSH PRIVILEGES;

Repeat it for each db server, changing IP and proxy user.

David Burgos

Read more posts by this author.