Is there a way to copy all the data in a mysql database to another? (phpmyadmin)


Solution 1

In phpMyAdmin, just export a dump (using the export) tab and re-import it on the other server using the sql tab.

Make sure you compare the results, I have had phpMyAdmin screw up the import more than once.

If you have shell access to both servers, a combination of

mysqldump -u username -p databasename > dump.sql

and a

mysql -u username -p databasename < dump.sql

on the target server is the much more fast and reliable alternative in my experience.

Solution 2

Have a look at

Copying MySQL Databases to Another Machine

Copy MySQL database from one server to another remote server

Solution 3

Please follow the following steps:

  1. Create the target database using MySQLAdmin or your preferred method. In this example, db2 is the target database, where the source database db1 will be copied.

  2. Execute the following statement on a command line:

mysqldump -h [server] -u [user] -p[password] db1 | mysql -h [server] -u [user] -p[password] db2

Note: There is NO space between -p and [password]

I copied this from Copy/duplicate database without using mysqldump. It works fine. Please ensure that you are not inside mysql while running this command.

Author by


Programming! Coding!

Updated on July 11, 2022


  • ggfan
    ggfan 3 months

    I want to copy all the tables, fields, and data from my local server mysql to my hosting sites mysql. Is there a way to copy all the data? (It's only 26kb, very small)