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

Advertisements

Thank for your comments

Fill in your details below or click an icon to log in:

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.