To backup a MySQL database we need to know a name of the specific database we would liken to backup. Let's assume that we are going to backup a database named mysql-data.

$ mysqldump -u root -p mysql-data  mysql-data-backup.sql

The previous command will dump / backup database mysql-data into a file mysql-data-backup.sql. -u option specifies a user with access to the mysql-data database and -p option will prompt for a root password.
To restore a MySQL database from a backup file the following command can be used:

$ mysql -u root -p mysql-data < mysql-data-backup.sql

This will restore a database from a backup file to a destination database mysql-data. Usage of -p and -u options with mysql command is the same as in previous command.

Free Linux eBooks

Linux Technical Writer

LinuxCareer, Casual, Volunteer, Home Based

Do you wish to join Linuxcareer.com project and find out how to be a technical writer? We are now looking for volunteers to help us write tutorials and share them with Linux community

  • Casual work from home
  • 10 articles / year

Any active Linuxcareer.com’s author will be entitled to following benefits:

  • actively participate in Linuxcareer.com’s decision making process
  • feedback and help

APPLY

Do you have the right skills?

Our IT Skills Watch page reflects an up to date IT skills demand leaning towards the Linux and Unix environment. We have considered a number of skills and operating systems.

See the result...

Linux Online Training

Learn to run Linux servers and prepare for LPI certification with Linux Academy. 104 available video lessons with PDF course notes with your own server!

Go to top