Back Up and Restore MYSQL Database The Easy Way

If you’re reading this blog, you probably know what MYSQL Database Server is. So, I’m not going to go into the detail of describing what it is.

I am actually going to show you how to quickly backup and restore your  MYSQL Databases the easy way.

 

The first step is knowing the database you’re working with. To do this, logon to MYSQL Server and display all the databases.

 

1) Login to MYQL Server

 

mysql_server

 

2)  To display all databases available on the server run the command below.

show databases;

 

3) Knowing which database to backup, type ‘quit’ to logout of MYSQL and run the command below to backup the database.

mysqldump -u root -p databse_name > database_name.sql

Replace ‘databse_name’ with the name of the database you want to backup.

 

4) To restore the database, login to MYQL Server and delete the current database, then create a new one.

drop database databse_name;

create database database_name;

 

5) After creating the new database, logout of MYSQL and restore the backed-up database.

mysql -u root -p database_name < backedup_database.sql

 

 

That’s all. Your database is restored.

Reblog this post [with Zemanta]

blog comments powered by Disqus
Twitter Delicious Facebook Digg Stumbleupon Favorites More