Press "Enter" to skip to content

How to Import / Export a MySQL database on the Linux Command line as a dump

Do you want to Import / Export a MySQL database on the Linux Command line as a dump?

Here’s are the easy step-by-step how to Import / Export a MySQL database on the Linux Command line as a dump:

To import a mysql database dump into a database:

mysql database_name < database_exportname.sql

To import one of these mysql databases from the dump into a database:

mysql --one-database database_name < all_databases_export.sql

To export a mysql database (as a dump) from the command line run:

mysqldump database_name > database_exportname.sql

To export all databases into a dump:

mysqldump --all-databases > all_databases_export.sql