Database backup fails when DB password contains !
-
Hello.
First of all, thanks for the great plugin. It’s a very nice way to backup a WordPress blog.
Unfortunately, Revisr fails to backup my database because my MySQL password contains an exclamation point (!) and when the plugin executes the mysqldump command, its parameters are not enclosed in quotes.
This causes the shell (Bash in my case) to parse the exclamation point in my password instead of treating it as a string literal and thus the command fails to execute.
I have fixed this on my installation but it would be good to include the fix for others.
All that that was needed to fix this issue for me was to single quote all the parameters in the mysqldump connection strings on lines 27 and 30 in class.revisr_db.php.
Line 27:
From:$this->conn = "-u " . DB_USER . " -p" . DB_PASSWORD . " " . DB_NAME . " --host " . DB_HOST;
To:$this->conn = "-u '" . DB_USER . "' -p'" . DB_PASSWORD . "' '" . DB_NAME . "' --host '" . DB_HOST . "'";
Line 30:
From:$this->conn = "-u " . DB_USER . " " . DB_NAME . " --host " . DB_HOST;
To:$this->conn = "-u '" . DB_USER . "' '" . DB_NAME . "' --host '" . DB_HOST . "'";
- The topic ‘Database backup fails when DB password contains !’ is closed to new replies.