Len_Jacobson
8-20-09, 10:49 PM
I am trying to manage my own backup of the database via a PHP script. That is, I want it to be an automated process rather than a manual process.
The following is a snippet of code to execute 'mysqldump()' on my database:
if (system("mysqldump -u " . $superUser . " -p" . $superPassword . " [name of database] > $fullPath") !== false)
echo "<p>Database backed up to '" . $fileName . "'</p>";
else
echo "<p>Error backing up database</p>";
This code works perfectly fine on either of my two test servers (running Windows Vista), but doesn't produce any output when run on the PowWeb.com web server. Interestingly, it also does not display my "Error backing up database" message. Instead, it displays the "Database backed up to ..." message.
I would like to be able to test the 'mysqldump()' command directly in an SSH session window, but PowWeb.com doesn't allow such a connection. So I can't see if that produces an error.
But on GoDaddy.com, I can open an SSH session window and run the command. When I do that on GoDaddy.com, it does produce the following error:
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect
Obviously, I can't be certain that the <<name removed>> error message is applicable to what is happening on the PowWeb.com web server, but my gut tells me it is.
Can anyone please offer any suggestion as to why I can't run the 'mysqldump()' successfully? Again, it does work perfectly well on both of my test servers (running Windows Vista).
Thank you.
The following is a snippet of code to execute 'mysqldump()' on my database:
if (system("mysqldump -u " . $superUser . " -p" . $superPassword . " [name of database] > $fullPath") !== false)
echo "<p>Database backed up to '" . $fileName . "'</p>";
else
echo "<p>Error backing up database</p>";
This code works perfectly fine on either of my two test servers (running Windows Vista), but doesn't produce any output when run on the PowWeb.com web server. Interestingly, it also does not display my "Error backing up database" message. Instead, it displays the "Database backed up to ..." message.
I would like to be able to test the 'mysqldump()' command directly in an SSH session window, but PowWeb.com doesn't allow such a connection. So I can't see if that produces an error.
But on GoDaddy.com, I can open an SSH session window and run the command. When I do that on GoDaddy.com, it does produce the following error:
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect
Obviously, I can't be certain that the <<name removed>> error message is applicable to what is happening on the PowWeb.com web server, but my gut tells me it is.
Can anyone please offer any suggestion as to why I can't run the 'mysqldump()' successfully? Again, it does work perfectly well on both of my test servers (running Windows Vista).
Thank you.