How to Import a MySQL Database

From Brian Nelson Ramblings
Jump to: navigation, search

How to Import a MySQL database

If you are making backups of your database's at some point you will need to import them due to a crash.

How to Import an Entire database

Importing the entire database via the command line

mysql -u <username> -p <databasename> < backup.sql

**Note if you have not already created the database, you will need to

mysql -u <username> -p -e"create database <databasename>;"

Sometimes, you will need to restore a single table

How to Import a Database Table

Importing a single database table

 mysql -u <username> -p <databasename> < backup.table.sql