Quite often I like backing my databases up as .sql files, which then comes in handy for also moving databases around, or making copies of them. The question is, given your Ubuntu server and the mysql command, how do you import a .sql file?
Well first, you enter the mysql console in the usual manner:
mysql -u USERNAME -p
Once in, switch to the database that you want to run the SQL import against:
mysql> use DATABASE_NAME;
With the database changed, the next step is to actually do the SQL import itself:
mysql> source PATH/TO/FILE.sql;
Easy as that. Of course, you could just have done the whole thing via the terminal command line if you didn’t want to access the MySQL console in the first place:
mysql -u USERNAME -p DATABASE_NAME < PATH/TO/FILE.sql
Nifty.