mysqldump failed cannot connect to /var/run/mysqld/mysqld.sock
jazzi opened this issue · comments
Hi, got the following error while running mysqldump -u user -p databasename > new.sql
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) when trying to connect
Trying to run backup.sh
after edited the config, it shows the error as below.
2022-06-02 10:13:42 Backup progress start
2022-06-02 10:13:42 MySQL dump start
2022-06-02 10:13:42 MySQL all databases backup failed
So where is the mysqld.sock
? Is this missing file the key to the problem?
After systemctl status mysqld
, it shows mysqld is active and running.
Thanks.
if you install LAMP by this script, default is /tmp/mysql.sock
Thanks. After exposing the right location of mysql socket by the following command, I still get the same error. Any ideas?
sudo usermod -d /tmp/ mysql
/var/run/mysqld/mysqld.sock
Doesn't look like it was installed by LAMP script.
Sorry can not help you, please Google it.