MySQL Tricks
Import Database

Importing MySQL Databases from a .sql file

Import a .sql file from the MySQL command line

After entering the MySQL shell with the mysql command, you can use the "source" command to import your_sql_file.sql

First make sure that you change directories to where your .sql dump is located like cd /root

use db_name;
SET autocommit=0 ; source your_sql_file.sql ; COMMIT ;

Import a .sql file from bash

Alternatively, you can import a .sql file from bash:

mysql -p db_name < your_sql_file.sql