Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysqldump failed cannot connect to /var/run/mysqld/mysqld.sock #242

Open
jazzi opened this issue Jun 2, 2022 · 3 comments
Open

mysqldump failed cannot connect to /var/run/mysqld/mysqld.sock #242

jazzi opened this issue Jun 2, 2022 · 3 comments

Comments

@jazzi
Copy link
Contributor

jazzi commented Jun 2, 2022

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.

@teddysun
Copy link
Owner

teddysun commented Jun 2, 2022

if you install LAMP by this script, default is /tmp/mysql.sock

@jazzi
Copy link
Contributor Author

jazzi commented Jun 2, 2022

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

@teddysun
Copy link
Owner

teddysun commented Jun 2, 2022

/var/run/mysqld/mysqld.sock Doesn't look like it was installed by LAMP script.
Sorry can not help you, please Google it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants