How do I Export and Import a MySQL Database ?

There are times during migrations, database restores etc that you will need to export and import your MySQL database. Below shows you the commands required to achieved this.

Note : This article is meant as a reference point rather then a full blown article.


mysqldump -u root -p {database} > db.sql


mysql -u root -p -h {database} < db.sql

Tags: Database

About the Author


R Donato

Rick Donato is the Founder and Chief Editor of He currently works as an SDN/NFV Solutions Architect and has a keen interest in automation and the cloud.

You can find Rick on Twitter @f3lix001