This tutorial will show you how to use the Command line to import a MySQL database. To import an existing file into MySQL, you will need to create a new database. This is where the SQL file's contents will be imported.
first time login your mysql .
Here Command :
1.login: sudo mysql -u username -p password
2.Create Database : Use this command to create a database after logging into MySQL. Make a database. TYPE OF DATABASE;
3. After create database than enter your db using this command . Use Your DATABASE NAME;
4. After Entry database than use this command and import database. source path ; [ example source /var/html/db.sql ]
5.Or this command mysql -u username -p db_name < file.sql
* username : Username with which you connect to the database
*db_name: The just formed database's name
The SQL file to import, *file.sql, is in the current directory.