hello.,

i was trying to create a script to backup my database, but seems that the main command is not working, any idea?

mysqldump -ppassword --user=user --host= host --add-drop-table databse> dbcontent.sql
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) when trying to connect

ofcourse i replaced the password username and dbname in the post:)

Comments

Marco Palmero’s picture

I got the same error - I'll post again once I find the solution.

Update: The error was caused when I tried to log into another mysql database which wasn't on the localhost via SSH putty. You need to access your mysql DB via the localhost.