Restore a MySQL DB.

When moving from one server to another:

If the DB doesn’t exists:

If you want to restore to the same server, but with another DB name:

Create the DB first:

mysql> create database backup;

mysql – u user_name -p your_password backup < file_name.sql

If your database already exists and you are just restoring it (this will overwrite the DB), try this line instead:

mysqlimport -u user_name -p your_password database_name file_name.sql


Thinking about someting? Leave a Reply...

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s