Difference between revisions of "How to Import a MySQL Database"

From Brian Nelson Ramblings
Jump to: navigation, search
(Created page with "==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 databas...")
 
(How to Import a Database Table=)
 
Line 15: Line 15:
 
Sometimes, you will need to restore a single table
 
Sometimes, you will need to restore a single table
  
===How to Import a Database Table====
+
===How to Import a Database Table===
  
 
Importing a single database table
 
Importing a single database table
  
 
   mysql -u <username> -p <databasename> < backup.table.sql
 
   mysql -u <username> -p <databasename> < backup.table.sql

Latest revision as of 22:58, 12 March 2014

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