RE: [PHP] Transferring MySQL table...
| From: | Maxim Maletsky | Date: | Thu, 31 Aug 2000 08:29:04 +0000 |
| Subject: | RE: [PHP] Transferring MySQL table... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-14546@lists.php.net to get a copy of this message | ||
Thanks Heikki!
I've done it!
-----Original Message-----
From: Heikki Korpela [mailto:heikki.korpela@wapit.com]
Sent: Thursday, August 31, 2000 5:04 PM
To: Maxim Maletsky
Cc: PHP General List. (E-mail)
Subject: Re: [PHP] Transferring MySQL table...
Maxim Maletsky wrote:
> Hi,
> a simple question:
> How to copy(transfer) a database or even a table would be enough to
another
> server.
> I need to transfer my existing table from the "real" server to "test"
> server.
> So there I could play with it...
> Thanks, and sorry for my previous message - escaped from me :-))
If you don't need PHP to do it, you can either
[1] Dump it with mysqldump from shell on real server:
mysqldump -a -e --add-locks database > dump.txt
Copy it to the test server from commandline on real server with e.g.
scp dump.txt testserver:
And then read it with mysql from shell prompt on test server
mysql database < dump.txt
Replace the 'database' with your database name
If you are able to connect to the 'real' server from the test server,
you
can even do
mysqldump --host=real -a -e --add-locks database | mysql --host=test
database
Replace the hosts accordingly.
OR
[2] Use the MySQL inbuilt syntax from mysql prompt:
mysql> SELECT * FROM database.table INTO OUTFILE '/tmp/data.txt'
From shell prompt:
scp data.txt test:/tmp/
On test server, from mysql prompt:
mysql> LOAD DATA INFILE '/tmp/data.txt' INTO TABLE table
Again, replace 'database', 'table' and 'test' accordingly.
> Maxim Maletsky - maxim@j-door.com
> <mailto:maxim@j-door.com>
> Webmaster, J-Door.com / J@pan Inc.
> LINC Media, Inc.
> TEL: 03-3499-2175 x 1271
> FAX: 03-3499-3109
--
| Heikki Korpela | heikki.korpela@wapit.com | tel. +358 50 3838 609 |
| Software Developer, Wapit Finland | http://www.wapit.com |
--
"Ain't working? Umm.. has the operating system been updated?"
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net