The following is a short code snippet on how to view which MySQL databases are available for a user, then a command to back them up. This should work on Unix and Linux variants.

To view what databases are available to be backed up, run the following command:
$ mysql -u root -h localhost -p -Bse 'show databases'

To backup each database, run the following command:
$ mysqldump -u root -h localhost -pmypassword databasename | gzip -9 > faqs-db.sql.gz

  • No comments found
Add comment

About Me

Josh Lyon Profile Picture

Name: Joshua Lyon
Location: Dallas, TX
E-mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
ProfilesGoogle, Twitter, GitHub
Other Sites:
     L2 Technology Services