InMotion Hosting Support Center

I'd like to execute a mysqldump command using exec() in PHP. However, I'm not able to get any status feedback from exec("mysqldump --user ..... etc. ). Is mysqldump available to me to execute from an exec command, and if so what path would I need to us

Category: Phpbb

Steve.
Asked:
2013-04-02 2:35 pm EST

Hits: 3,097

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

You must login before you can submit an answer.

OTHER ANSWERS

1

scott
Staff
43,761 Points
2013-04-02 2:53 pm EST
Hello Steve,

You can definitely use the exec command to do a mySQL dump. The syntax you want to use is:
/usr/bin/mysqldump -pPASSWORD -u DB_USERNAME DB_NAME > FILENAME.sql

The path /usr/binshould not be necessary, but is included for efficiency.

Best Regards,
Scott M

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

HI Scott-- thanks for the syntax and quick response! I've stripped down the mysqldump syntax to just what you've shown. I've ended up with a 0kb file (this is what I had before and had assumed that the reason was that mysqldump wasn't available). Is there any way I can get debugging info back as to why the mysqldump is not working.... given that I probably do have access to the function? setting the output of the exec function to a variable indicates to either a null or empty response.
Steve.
11 Points
2013-04-02 3:11 pm EST
ok-- found out that I can add a --log-error='backups/errors.txt' to the parameters. I had a credentials issue plus I had tried to use an option I had found searching online that actually wasn't supported in the command. Thanks for letting me know that the command should work.
Steve.
11 Points
2013-04-02 5:45 pm EST
Like this Question?

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Social Media Login

   
Social Login Joomla

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!