Don't know if this is the case or not, but the destination database has to 
already exist on the upload server.


"Nate Nielsen" <[EMAIL PROTECTED]>

11/17/2004 10:08 AM



RE: [PHP-DB] mysql db dump with php

I tried this but to no avail.  What I surmise is that one of the following
is holding this up from being an option.

1) I'm on a shared server so I will have to specify the location of the 
to save in order to get to it afterwards.  I tried specifying the path and
the file name in the examples below but didn't get the resulting file as I

2) Its possible that the web server does not have the command available as
the mysql server is on another box, thus I won't be able to execute it.  I
am not familiar with mysql, so I'm not sure if this could be the case, is 
possible to have the drivers and not the supporting utilities installed?

3) Somehow shell execution is not enabled (exec()).  I do not think this 
the case as I am not thrown an error.  It would be possible though I would
think that the php script process doesn't have access to execute that
process maybe?

Any suggestions or another method? 

Thanks a ton!


-----Original Message-----
From: Jason Wong [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 17, 2004 12:11 AM
Subject: Re: [PHP-DB] mysql db dump with php

On Wednesday 17 November 2004 13:51, Nate Nielsen wrote:

> i need a script that will connect to a db with a username and password,
> then export to the screen scripts to both recreate the database 
> (the create table commands) and then create insert statements to 
> that information into the database.  then of course, i need to run those
> scripts on the other server to create the db and populate it.

>From the command line of the system holding source database:

  mysqldump --opt -u username -p password nameofdatabase >

Now take the created file nameofdatabase.sql and place onto the system
destination database. Then from the command line of the system holding 
destination database:

  mysql -u username -p password < nameofdatabase.sql

If you don't have direct access to the command line use php's program 
execution functions.

> if you can hook me up i'll paypal you $20 bucks to buy you and yours a 
> pints of your favorite ale on me.

Donate it to your local Red Cross/Red Crescent or equivalent.

Jason Wong -> Gremlins Associates ->
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
Search the list archives before you post
Logoff in progress...

PHP Database Mailing List (
To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to