Find the answer to your Linux question:
Results 1 to 4 of 4

Thread: Mysqldump

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1



    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 "/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";
    Is my actual mysqldump statement correct? I'm really new to linux. The dedicated server we rent uses ubuntu if that helps.

    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?


  2. #2
    Just Joined!
    Join Date
    Jun 2008
    Memphis, TN
    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.

  3. #3
    Try removing the space between the -p and the password variable - this is probably the reason... LEt me know how you get on

  4. $spacer_open
  5. #4
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts