Migrating SQL Databases Between Servers

mysql-logoMy web host has installed a new, state of the art SQL database and I am moving my sites over to it one by one.  As some of my databases are super large I can't export them to my computer and then import them to the new server without the import process severely timing out.

However, I am able to migrate the contents of one database to another using the following commands in SSH - shelling into the server (I use putty.exe).

mysqldump -u [username] -p[password] -h mysql55 [dbname] > dump.sql 

mysql -u [username] -p[password] -h mysql [dbname] < dump.sql

Remember that the new database must already exist to copy to it.

Note that there is nospace between "-p" and the password of your SQL user.

Also, please note that the above sql servers (mysql55 and mysql) are what my host has named their 2 SQL servers.  I've left those names as a reminder to me when I use this article to remind me of the exact commands. You'll definitely want to use the names of the SQL servers of your host.


subscribe basic joomla

subscribe cybersalt

@media (max-width: 767.98px) img.avatartim { width: 50%; }