MySQL server has gone away

When restoring a MySQL database, i get error “MySQL server has gone away”.

To fix this, edit MySQL configuration file. Add following line under [mysqld] section.

Restart MySQL

If you use MariaDB

Related Posts



Ubuntu 18.04 MariaDB 10.2 Too many open files

On my computer running Ubuntu 18.04, MriaDB stopped working. PHP application i run on my computer failed with error

Application can’t find the table. So i tried to login to MySQL and see if table is there or not. But i get error

Next i checked if this is due to any MySQL upgrade. I found MySQL got updated today

To fix this error, run

This wil open a text editor. Add following

Save and quit the editor. Restart MaraDB with

MySQL will work properly now. systemctl edit mysql will create file /etc/systemd/system/mysql.service.d/override.conf


Install MariaDB 10.3 on CentOS 7

MariaDB is an Open Source MySQL drop in replacement. MariaDB provides repository for various operating systems at

To install MariaDB 10.3 on CentOS 7, create file


Install MariaDB server and client with

Enable MariaDB start on boot

Start MariaDB

MariaDB DEFAULT NULL ERROR 1064 (42000)

When trying to restore a MySQL databse bakcup taken on MySQL 5.7 server to MairaDB 10.1 server i get following error.

Source server

Destination server

I opend the SQL file in editor and checked line 287, i run the SQL in mysql, that resulted in error

I run the command on a MariaDB 10.2 server and it worked.

To fix the problem, upgrade MariaDB to version 10.2 or above. In this case, i went with MariaDB 10.04 and it worked fine.

MariaDB Repository Setup Script

This script configure MariaDB repository on your server. You can find more details on offical page

To setup mariadb repo, run

I was expecting it ask me what version of MariaDB i like to setup. But it just setup MariaDB 10.4. I wanted to upgrade MariaDB to version 10.2, anyway i did upgrade to 10.4 and everything worked fine.

If you need a speicfic version, you can run like

Availabe versions are

When i run the script on Debian 9 server, i get following error

This is fixed by running