How to Export & Import MySQL database in Linux

Export MySQL database

To export mysql database, use the mysqldump command.

# mysqldump -u root -p database-name > backup.sql
e.g
# mysqldump -u test -p abc > abc_backup.sql

Import MySQL database

To import mysql database, use the mysql command.

# mysql -u root -p database-name < backup.sql
e.g
# mysql -u test -p abc < abc_backup.sql
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *