Automated MySQL backup

Category: Databases

Igontech
Asked:
2013-01-15 1:07 pm EST

Hits: 482
I'm trying to schedule a mysql backup from cron. The job runs (not a cron) problem, but the mysqldump is empty. The script I'm running in in php, has permissions of 755, and I'm on a shared hosting plan (pro).

Here's a snippet of code with the command I'm trying to execute. In the example below $message is always null and $retval is 0.

Are we allowed to run exec() or system() from php? Perhaps that is my problem. if not, is there a way for me to accomplish this in some other way, like a Perl script or something?

$command = "mysqldump -u{$dbUsername} -p{$dbPassword} $dbName | gzip > $backupPath";

$message = exec($command, $output, $retval);

echo "$backupFile :: $message :: $retval";

You must login before you can ask a follow up question.

You must login before you can submit an answer.

OTHER ANSWERS

0

Scott
Staff
20,340 Points
2013-01-15 4:12 pm EST
Hello Igontech,

It is best to have our Tier 2 or Systems team take a look at your specific script. They may have better ideas on setting up the code and what commands can and cannot be used when creating a Cron.

To do so, you would need to contact our support department at support@inmotionhosting.com with that request. Be sure to validate your account with either the last 4 digits of the credit card on file, or the current Account Management Panel (AMP) password.

Best Regards,
Scott M

You must login before you can post a comment about this answer.

Like this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!