I have a server with numerous virtual hosts. I run two daily scheduled Virtualmin backups, one for local, and one for Amazon S3, scheduled about 1 hour apart. Frequently one or the other backups fails with this message:
mysql::execute_sql failed : DBI connect failed : Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2) at /usr/share/webmin/web-lib-funcs.pl line 1433.
This tends to happen part way through the backup on the “SQL dump” part of a virtualhost backup.
As mentioned this doesn’t happen all the time, but it does happen multiple times per week.
Can anyone offer any insights into how I might fix this?
Are you using a “dedicated server” or “vps”?
What are the specs of the machine or vps?
As a general rule, it’s possible that when the backups fail, it is simply a matter of the database resources not being available. You might want to monitor the server/vps the next time the backup is being completed to see if it is running low on RAM and/or CPU resources while attempting to run the backup.
I’m running on a Linode VPS: 2 cores, 4 GB. Ubuntu 16.04
Generally, CPU and “Real Memory” has plenty free. Very low load on the CPU and less than 40% memory being used. My virtual memory tends to be mostly near-full, but I understand this isn’t a problem if real memory isn’t full.
I will try to monitor the resources during a backup.
So I haven’t noticed any extreme resource consumption, but I did enable status notifications for the MySQL service. During the most recent backup failure I got a “Mysql service is down” notification.
Incidentally, last night’s backups worked flawlessly. I wonder if there is something unstable about my MySql process. Are there useful logs I can check?
If you are using CentOS 7, you’ll find the “MariaDB” (which replaced “MySQL”) log at: