How to import data into a MySQL database using a .sql file

To do that use the following command: mysql -u usernamehere -p -h localhost databasenamehere < mysqlimportfilenamehere.sql; Please note that the mysqlimportfile should be in the same path where you are running this command from