Importing a Database To import a sql database using terminal, use this command: $ mysql -u username -p -h localhost DATABASE_NAME < file_name.sql Exporting a Database To export a database, use the following command: $ mysqldump -u username -p DATABASE_NAME > file_name.sql