To take a backup of MySQL database or databases, the database must exist in the database server and you must have access to it. The format of the command would be.
# mysqldump -u [username] –p[password] [database_name] > [dump_file.sql]
The parameters of the said command as follows.
- [username] : A valid MySQL username.
- [database_name] : A valid Database name you want to take backup.
- [dump_file.sql] : The name of backup dump file you want to generate.
Example, Backup Database :-
# mysqldump -u suraj –p moodle > /home/suraj/moodle.sql
Example, Restore Database :-
# mysql -u suraj –p moodle < /home/suraj/moodle.sql
No comments:
Post a Comment