Mysqldump custom socket path
-
My WordPress was migrated to a VPS with a socket MySQL connection.
Since that change Backupwordpress was giving this error when you try to make a database backup:
“Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock'”
In my case the socket path to connect to the MySQL server was defined in wp-config.php in this way:
define(‘DB_HOST’, ‘localhost:/tmp/mysql5.sock’);
I see Backupwordpress don’t support defining a custom socket path connection in this way, so to solve that I added a new line to the public function mysqldump() in the file /wp-content/plugins/backupwordpress/hm-backup/hm-backup.php after the line “$cmd .= ‘ –no-create-db’;”:
// Socket connection defined in host
$cmd .= ‘ –protocol=socket -S /tmp/mysql5.sock’;In my case the socket path is ‘/tmp/mysql5.sock’. Replace with your custom socket path.
I hope it help to improve this excellent plugin. Thanks!
The topic ‘Mysqldump custom socket path’ is closed to new replies.