To import the database’s dump file written by mysqldump,use mysql command. Learn to export database using mysqldump.
If the dump file was created using mysqldump command with –all-databases or –databases option, it contains CREATE DATABASE and USE statement.
# mysql < dump.sql
If the dump file is created as a single-database and not containing –all-databases or –databases, create the database first(if neccessary):
# mysqladmin create sqldb
Now, import the database in newly create database:
# mysql sqldb < dump.sql
Import database with username and password:
# mysql -u [USERNAME] -p < dump.sql // dump file created using –all-databases or –databases.
# mysql -u [USERNAME] -p sqldb < dump.sql // dump file not created using –all-databases or –databases.