Results 1 to 4 of 4
Hello,
I'm trying to use mysqldump from php.
Here is the php im using for this:
$dbhost, $dbuser, $dbpass are present, but not show for security reasons.
PHP Code:
$path ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 06-25-2008 #1Just Joined!
- Join Date
- Jun 2008
- Posts
- 13
Mysqldump
Hello,
I'm trying to use mysqldump from php.
Here is the php im using for this:
$dbhost, $dbuser, $dbpass are present, but not show for security reasons.
Is my actual mysqldump statement correct? I'm really new to linux. The dedicated server we rent uses ubuntu if that helps.PHP Code:$path = "/home/a/c/acornmedia/public_html/tools/sqlmagic/backup/";
$backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz';
$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $path . $backupFile";
system($command);
I'm not sure about the $path section, the person that commented on a different post wasn't clear whether this was the path to where the db should be moved to once gzipped, or where the db where it is dumped before its gzipped.
I basically want it to move the final .gz which contains the database dump to /home/a/c/acornmedia/public_html/tools/sqlmagic/backup/ which is the root path to the web area of the server.
However it doesn't work. No files get created in sqlmagic/backup/
Can anyone help?
Thanks
- 06-25-2008 #2Just Joined!
- Join Date
- Jun 2008
- Location
- Memphis, TN
- Posts
- 65
I'm not a php guy, but maybe it has to do with the permissions of the script. Also, it might be the permissions of your user account on the server.
- 06-26-2008 #3Just Joined!
- Join Date
- Jun 2008
- Posts
- 1
Try removing the space between the -p and the password variable - this is probably the reason... LEt me know how you get on
- 06-26-2008 #4Just Joined!
- Join Date
- Jun 2008
- Posts
- 13
yeah the problem was something to do with the password, as it was trying to use the variable for password as the database name,
I've ended up using --password=$dbpass
works fine now!
Thanks for the help.


Reply With Quote
