Jump to content

Problem with mysqldump and PHP


dzogchen

Recommended Posts

I have a rather large database that contains a few large tables and a large number of frequently changing very small tables i need to migrate to another server, and do it quickly so I minimize disrption of our site.

 

mysqldump doesn\'t seem to take wildcards, so i wanted to write a php script to automate the execution of mysqldump. I can generate the table names and then i put them into a string something like:

 

$dumpme = \"mysqldump --user=xxxx --password=xxxxx somedatabase $thistable > $thisdump n\";

 

and then use

 

$file = exec(\"$dumpme\");

 

if (!$file) {

echo \"Unable to dump file $thistable!<br> \";

 

}else{

 

echo \"dump of file $thisdump worked!<br>\";

}

 

if I take the string generated by echo $dumpme; and run it in a terminal window, it works.

 

If I run the php code, it fails.

i have also tried it with :

$file = exec($dumpme);

and it still fails. also shell_exec and passthru

 

Any ideas?

 

I thought of using php for generating a long shell script, and running that from the command line.

 

Any help appreciated

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.