Mysql always oocasional refused connection

Hi , after I deploy my laravel app , I occasional encounter mysql refused connection error.

I check mysql status

systemctl status mysqld 

it shows failed. I have to restart everytime in order to make it back to normal, it very annoying. I search around digitalocean community it looks like it’s comman issues mostly its memory issue. I want to check my root cause of this crash , so I want to access mysql error log from here i run the command sudo less /var/log/mysql/error.log but it return /var/log/mysql/error.log: No such file or directory any ideas where is error log for centos 8 ? thanks

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Make sure that the server has not been configured to ignore network connections or (if you are attempting to connect remotely) that it has not been configured to listen only locally on its network interfaces. If the server was started with the skip_networking system variable enabled, no TCP/IP connections are accepted. If the server was started with the bind_address system variable set to, it listens for TCP/IP connections only locally on the loopback interface and does not accept remote connections.

Check to make sure that there is no firewall blocking access to MySQL. Your firewall may be configured on the basis of the application being executed, or the port number used by MySQL for communication (3306 by default). Under Linux or Unix, check your IP tables (or similar) configuration to ensure that the port has not been blocked. Under Windows, applications such as ZoneAlarm or Windows Firewall may need to be configured not to block the MySQL port.

Hi there @stupidboy,

It is possible that the MySQL error logging is not enabled, in this case, you would need to enable the error logging.

You can check the location of your log file by first accessing MySQL:

  1. mysql -u root -p

And then run the following query:

  1. SHOW VARIABLES LIKE 'log_error';

Also besides that, what I could suggest is checking the following log for more information:

  1. tail -1000 /var/log/messages

Regards, Bobby