How to import an SQL file using the command line in MySQL?

mysql -u username -p database_name < file.sql

file.sql can be hosted in the new server where you are importing.