Copy MySQL table between databases

April 01, 2025

Using INSERT INTO ... SELECT can copy table from one database to another.

INSERT INTO target_db.table SELECT * FROM source_db.table;

Also can be use mysqldump to copy a table with its structure and data.

mysqldump -u user -p source_db table > table_dump.sql
mysql -u user -p target_db < table_dump.sql

Read more about mysqldump in Create and restore MySQL backups post.