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>

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more