What is the fix for MySQL server refuse to connect issue?

I’ve deployed a Laravel application on a CentOS droplet with MySQL. The issue is after I use Laravel tinker or use PHPMyAdmin, I get “Connection refused”. I have to restart MySQL server from SSH.

Any idea what’s the issue here? Thanks in advance.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

Does the MySQL service run fine after you restart it?

If so I could suggest a couple of things:

  • Follow the steps here on how to tweak MySQL/MariaDB Configuration for Increased Performance and Stability:

  • Check your system logs and MySQL logs to see what is causing MySQL to crash. You can find the logs at the /var/log directory.

As a side note, with all of the recent CentOS changes, I now personally use Ubuntu to host my Laravel applications. Along with this automation script that sets up the whole server for me:

Let me know how it goes. Best, Bobby