MySQL Backup Scripts

There are those occasions when the MySQL databases must be backed up. Two scenarios are available for backing up entire databases as well as multiple tables.

The first script will back an individual table.

[codesyntax lang="bash"]
mysqldump -u bcs -p $1 $2 > ~/sql/$2.sql
[/codesyntax]

The next script will back up all tables in the specified database.

[codesyntax lang="bash"] 
mysqldump -u bcs -p $1 > ~/sql/$1.sql
[/codesyntax]

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

Leave a Reply

Your email address will not be published. Required fields are marked *