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]  MySQL server has gone away
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:
[mysqld] join_buffer_size = 128M sort_buffer_size = 2M read_rnd_buffer_size = 2M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 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.
Restarting MySQL solves this for two or three days, then it happens again.