Importing a database from a shell:

If you already have a dump of the database you wish to import on a server, then run from your terminal window command to import it:

mysql -u username -ppassword database_name < dump.sql


Backup all available databases:

Run from your terminal window to get dump of all databases:

mysqldump -u username -ppassword -all-databases > dump.sql

Please note, that all databases in the example above will be dumped as a single file.