Backup a mysql database

From The IT Community
Jump to: navigation, search




Using mysqldump, backing up a MySQL database and restoring it, is really simple. All you need is the right credentials.


Here is how to backup a MySQL database:

  • Fist log on to the Linux server, the MySQL database is running on.
  • Go to a directory the current user has write permission.
  • Execute the following command to backup your MySQL database:
mysqldump -u [username] -p[password] [database_name] > [database_name].sql

Change [username] and [password] with a user (and his password) that has enough rights to read the database. Change [database_name] to the database you want to make a backup off.


That is it. Depending on the size of your database, this can take some time. After that, you will have a set of commands in the sql file with which you can restore a mysql database easily.



Was this article helpful? Then please donate to keep The IT Community alive...

If you found this article helpful please share it, comment and help others by writing your own article.






Translate this page: