I'm using MySQL 5.6.19 on OSX 10.9.5 (DMG installation from mysql.com) and I'm receiving the infamous MySQL has gone away when I try to open two connections to this server.

If I try connecting from PHP:

SQLSTATE[HY000] [2006] MySQL server has gone away

In mysql on Terminal, it won't connect either, but shows another error:

$ mysql -u root
ERROR 2013 (HY000): Lost connection to MySQL server at 'sending authentication information', system error: 32

I already changed a bunch of parameters in my.cnf, here is how it's now:

join_buffer_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M 
connect_timeout = 300
wait_timeout = 300
net_read_timeout = 300
net_write_timeout = 300
max_allowed_packet = 128M
max_connections = 50
table_open_cache = 1024
innodb_flush_log_at_trx_commit = 1

None of those parameters helped. max_allowed_packet is a famous solution, but even that isn't helping. This is really weird because I'm not even using the database, no queries running, nothing, I just open the first connection, and with the second I'm receiving the error.

Any idea?


Restarting MySQL solves this for two or three days, then it happens again.

  • 1
    I'm not sure it's related, but I think you have set join_buffer_size value way too high. – Manny Calavera Oct 17 '14 at 0:07
  • @MannyCalavera I know, but I tried it from 2MB to 128MB, and none helped. I'll lower it to 2MB again. – Rafael Kassner Oct 17 '14 at 1:15
  • Can you list the error log message? There's good chance the mysql crashed for some reason. – Manny Calavera Oct 17 '14 at 1:18
  • @MannyCalavera MySQL isn't crashing, the connection that is open runs query without any problem, but I can't open a second connection. My hostname.err has no errors listed, just MySQL's startup info. – Rafael Kassner Oct 17 '14 at 1:52
  • SET GLOBAL LOG_WARNINGS = 2; and try again? Then check the MySQL error log... – Michael - sqlbot Oct 17 '14 at 2:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.