Link to home
Start Free TrialLog in
Avatar of sebastiz
sebastiz

asked on

copy database in phpMyAdmin

I have got a live databse on one server which i administer via phpMyAdmin. I dont want to experiment with it too much so i want to make a copy and transfer onto another server. Does anyone know how i do this using phpMyAdmin or otherwise?
Seb
Avatar of jonesy2k
jonesy2k

you can just copy the binary database files from one machine to another...
On the live database server:
stop mysql
cd /var/lib/mysql (or whatever your mysql database directory is)
tar czvf datbase.tar.gz datbasename/
then copy that tarball to your other machine...
scp database.tar.gz user@server2:~
start mysql

on server 2:
stop mysql
cp ~/database.tar.gz /var/lib/mysql/
cd /var/lib/mysql
tar zxvf database.tar.gz (assuming the tarball is in the /var/lib/mysql directory)
start mysql
Hope this helps,
Jonesy
in phpMyAdmin you have the option to export the database.
if you select the database you want to export, select compression zip and check the box: Save as file

when you press the button Go, you'll be asked to download a ZIP file.
That archive will contain a .sql file which holds your database structure and data in the tables.

-Geir
Avatar of sebastiz

ASKER



I cant stop the mysql on the second server as it is owned by a hosting company on a shared server. I understand how to download the server, but how do i then reupload it if i cant stop the mysql server?
Seb
On the server where you use phpmyadmin use the export function, structure and data, then it's a matter of copy and paste, copy the file from your export then go to the other server open the query window and paste the result of the export, run the query, you will have the exact same database set up on the other server.

I did that with a db where I had a couple thousand entries, I first ran a query with just the create table query than I ran subsequent insert queries, 100 at a time.

If you have a couple millions entries this might be a problem.

Gamebits
ASKER CERTIFIED SOLUTION
Avatar of Andrew Wilkinson
Andrew Wilkinson

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial