how to backup and restore mysql database

This is the command line for backup and restore Mysql database.

it is recommended that you perform database backup before doing something you don’t really know.

  • Backup

# mysqldump -u <user_name>  -p  <database_name> > <backup_filename>

example : % mysqldump -u amin -p amin_database > amin_database_backup.sql

  • Restore

#mysql – u <user_name>   -p  <database_name> <  file_name.sql

example: % mysql -u amin -p amin_database < amin_database_backup.sql

Tagged with: , ,
Posted in mysql

Leave a comment