MySql Logs


Every week or so, I get alert that my website is down.
I try to open my blog (WP) just to see that it’s really down.

I see: Error Establishing a Database Connection

I checked if there are any logs for MySql but I couldn’t find it under system logs. I don’t know why on earth mysql would fail. Didn’t update, didn’t change any settings…


Usually when I see MySQL fail, it’s due to memory constraints of the server.

What output do you see if you run this command:

dmesg | tail -50

Do you see any messages about memory/RAM issues, and services being killed?


Hi Eric, thanks for your answer!

currently no, but I have restarted the server to fix the problem
Now I only see:
[92230.218839] BANDWIDTH_IN:IN=eth0 OUT= MAC=xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:f0:08:00 LEN=52 TOS=0x00 PREC=0x00 TTL=54 ID=55104 DF PROTO=TCP SPT=13318 DPT=80 WINDOW=16 RES=0x00 ACK FIN URGP=0

and very similar messages mostly the same.

I will check next time when MySql will fail.

I was just wondering couple of things.

  1. I come from win world and I assume that if something has failed, you have to restart the server, in this case this also helps but I heard that with linux you could just restart the service or something?

  2. When installing virtualmin I chose low memory for my sql, how and when would I know that memory is problematic?

  3. Is there a way I could set notifications if my sql fails?

  4. Can I automate that if My Sql fails that server is restarted or service is restarted?

  5. Is there anything I can do to lower memory footprint of the system?

Other than this problem, I am uber satsified with my vps/virtualmin
I was checking website speed with various tools and none of my freinds site match the speed of it. It’s really great adventure self hosting :slight_smile:


Yup, if MySQL fails, you only need to restart the MySQL service, you wouldn’t need to reboot.

How much memory do you have? You can determine that by running this command:

free -m

There are some monitoring and notification tools available in Webmin -> Other -> System and Server Status.

Also, there’s info on lowering the memory footprint here:

Hi Eric,

First of all thank your for our answers.
Post on low memory is really great and I will get down to it immediately!
Now about my problem.

Mysql failed on Friday.
Until now only thing going on in my mind was, should I really upgrade to next plan where 1GB RAM is included instead of 0,5GB.

Then I checked my cloudflare account and noticed that on Friday I had 3036 pageviews, usually I get from 300 - 400 per day, so perhaps I was DDoSed.

I am running wordpress with some plugins and that means that with every visit there are several sql queries (from wordpress + plugins) and that means that you are correct and that Mysql didn’t have enough memory causing it to fail.

Would you know what can I do to optimize my VPS for DDoS (or slashdot or similar effect)

Hi Eric,

I found it, like you said, under Webmin -> Other -> System and Server Status there is an option to run a command if monitor goes down. But which command should I enter in ubuntu LTS to restart mysql service?

This command can start the MySQL service on Ubuntu:

/etc/init.d/mysql start

Hello can anyone let me the know the issue which i am facing again and again on my live site ,

Error :
SQLSTATE [HY000] [2002] Can not connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’

My vps mysql server going down again and again , after restart mysql server site back to normal, after sometime site goes down , tried with multiple users

As mention in the above comments as for : dmesg | tail -50 , please check the attachment .

I have free space of 1.9 gb in real memory , Local disk space : 13.27 GB used, 39.25 GB total

Do we have any solution on this .

Just in case I missing something … is there really no way to look at MySQL logs in virtualmin (or webmin)?