How to restore MySQL backups

Recently I moved this blog to Vultr, so I needed remind how to restore MySQL backups. Follow reading to find out how:

How to restore MySQL backups

Please note to change:

  1. host (hostname or IP)
  2. user (the MySQL username)
  3. database (your database name)
  4. backup.sql (backup file including extension)
    …in the next code examples:

mysql -h host -u user -p database It will prompt your password, type it and press ENTER. You will not see the password while you are entering.

Database name error?

Sometimes if it's a clean install, you need to create the database before run it if the script doesn't include it.

Login in mysql console:

mysql -h host -u user -p

And run:

CREATE DATABASE your_db_name;

Remember to change the your_db_name text.

And logout


Leave a comment with your doubts, experiences or problems 🙂

David Burgos

Read more posts by this author.