How to Import a MySQL Database

From Brian Nelson Ramblings
Revision as of 22:58, 12 March 2014 by Brian (Talk | contribs) (How to Import a Database Table=)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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