Monday, 24 December 2018

MySQL Database Import And Export Operations

Take Backup With Data

Open Command Prompt (cmd)
# mysqldump -u dbusername -p db_name > /tmp/db_fullbackup.sql

Take Only Metadata Backup


# mysqldump -u dbusername -p –no-data db_name > /tmp/db_backupmetadata.sql
or
# mysqldump -u dbusername -p -d db_name > /tmp/db_backupmetadata.sql

Restore Database Metadata From Backup


# mysql -u dbusername -p db_name < /tmp/db_backupmetadata.sql

Restore Database From Backup


# mysql -u dbusername -p db_name < /tmp/db_fullbackup.sql

0 comments:

Post a Comment