Copying MySQL Tables The Easy Way

From the command prompt, like this:

mysqldump oldDatabase > /tmp/oldDatabase.sql
mysqladmin create newDatabase
mysql newdatabase < /tmp/oldDatabase.sql

You may need to preface the above commands with the /path/to/your/mysql/bin directory. You may need to have mysql prompt you for a password by adding the -p flag to the mysqldump, mysqladmin, and mysql commands.

More articles in the Archive →