DEV Community

Ayuth Mangmesap
Ayuth Mangmesap

Posted on

Fixed MariaDB/MySQL: “2006, MySQL server has gone away"

An error screenshot of “2006, MySQL server has gone away" from the phpmyadmin login screen

I have spent almost 6 hours solving this connection when the phpMyAdmin cannot connect to the MariaDB in Instance B so that’s why I decided to write this blog to save you time (of course we do that all in our dev community such as StackOverflow or such kind of this site).


The various solution might be found when you google search. So I will not provide those solutions in this post.

Instances A and B in the same network

The application is using MariaDB and keeps connecting to the MariaDB database and the error thrown

Image description

After spending almost 6 hours solving those problems. I decided to write the blog to save you time.

sudo vim /etc/mysql/mariadb.conf.d/50-server.cnf
Enter fullscreen mode Exit fullscreen mode

The configuration file that defines the connection only accepts when a connection is coming from locally only<br>

Find the [mysqld] section and find the bind-address then comment on that line by inserting the # in front-of-the-line configuration.

Image description

Then restart the service to accept new changes

sudo systemctl restart mariadb
Enter fullscreen mode Exit fullscreen mode

And try to connect to it using phpMyAdmin, any tools, or CLI as you preferred. Then the result should be connected successfully.

The phpmyadmin site indicates that the connection has been established<br>

Top comments (0)