Re: mysql db dump with php
| From: | Jason Wong | Date: | Wed, 17 Nov 2004 06:11:28 +0000 |
| Subject: | Re: mysql db dump with php | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-37314@lists.php.net to get a copy of this message | ||
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, and
> then export to the screen scripts to both recreate the database structure
> (the create table commands) and then create insert statements to populate
> 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 > nameofdatabase.sql
Now take the created file nameofdatabase.sql and place onto the system holding
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 few
> pints of your favorite ale on me.
Donate it to your local Red Cross/Red Crescent or equivalent.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
------------------------------------------
/*
Logoff in progress...
*/