Re: Move Database
| From: | Krzysztof Dziekiewicz | Date: | Mon, 09 Dec 2002 12:34:46 +0000 |
| Subject: | Re: Move Database | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-127482@lists.php.net to get a copy of this message | ||
> Hi,
> I am moving my site from one server to another, how can i copy all the data
> in my datbase to my new server? Also is it possibel to do this one table at
> a time?
Backup from command line:
mysqldump -h <MYSQLHOST> -u <MYSQLUSER> -p <DATABASE> > backup.sql
or
mysqldump -h <MYSQLHOST> -u <MYSQLUSER> -p <DATABASE> <TABLE 1>
<TABLE 2> ... <TABLE N>> backup.sql
In backup.sql you get CREATE and INSERT syntax.
In new server you can execute:
mysql -h <NEWMYSQLHOST> -u <MYSQLUSER> -p <DATABASE> < backup.sql
Of course in new server you must create DATABASE before.
--
Krzysztof Dziekiewicz