Import / Export a mysql database from command line or terminal


Welcome to Linux Solution

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

# mysqldump database_name > database_exportname.sql
OR
# mysqldump database_name -u root -p > database_exportname.sql

To import a mysql database dump into a database:

# mysql database_name < database_exportname.sql
OR
# mysql database_name -u root -p < database_exportname.sql

To export all databases into a dump:

# mysqldump –all-databases > all_databases_export.sql
OR
# mysqldump –all-databases -u root -p > all_databases_export.sql

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

# mysql –one-database database_name < all_databases_export.sql
OR
# mysql –one-database database_name < all_databases_export.sql

View original post

Thank for your comments

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s