Mysql server has gone away

I sometimes randomly get: “mysql server has gone away” when connecting LibreOffice Base to MySQL. I must reestart Base before I can proceed.

I’m using:

  • OS: Debian 8.6 (Jessie stable)
  • Database server: MariaDB 10.1 MySQL Server (the most recent version)
  • App: LibrieOffice Base 5.2.2.2 (the most recent version)
  • Extension: mysql connector 1.0.4_3 (“MySQL Native Connector for Linux for 4.2 and 4.3”) (the most recent version)

Normally with database connectors there is a place to set up connection parameters. One such parameter in a connector I’ve used is “keep-alive” which fixed this behavior for me before.

But I’m not sure where to set up any connection parameters for this extension.

Furthermore, I don’t know who produced or supports this connector. (See: LibreOffice | Base | Tools | Extension Manager | Get more extensions online… | Extensions | Base-extensions | MySQL Native Connector for Linux for 4.2 and 4.3). The only reference there is to: http://www.documentfoundation.org/ which is just a generic home.

Any help is much appreciated.

  1. Stop your MySQL server, (In linux: services mysql stop),
  2. in /etc/my.cnf check and possibly increase the value of wait_timeout. Mine was set at 600 (seconds, or 10 minutes) but you can set it much higher, and MySQL says the “default” is 28800 (or 480 minutes, = 8 hours).
  3. Restart your MySQL server, (In linux: services mysql start),

from: http://piwik.org/faq/troubleshooting/faq_183/

. "The MySQL server has gone away has two main causes and solutions:

Server timed out and closed the connection. To fix, check that “wait_timeout” mysql variable in your my.cnf configuration file is large enough.

Server dropped an incorrect or too large packet. If mysqld gets a packet that is too large or incorrect, it assumes that something has gone wrong with the client and closes the connection. To fix, you can increase the maximal packet size limit “max_allowed_packet” in my.cnf file, eg. set max_allowed_packet = 128M, then sudo /etc/init.d/mysql restart."

This would be a great solution when you control the server, but mine is at a hosting service. I need to be able to reconnect from LO after it has disconnected so I don’t lose data entered painstakingly into a form…

1 Like