Import a mysql database from terminal

mysql -u username -ppassword databasename < filename.sql

Example
Username: daniel
Password: 123Headadmin
Database name: my_new_db
Database file name: my_old_db.sql

mysql -u daniel -p123Headadmin my_new_db < my_old_db.sql

Leave a Comment