A script for backup mysql
Here is a nice script for backup your mysql-database.
With this simple linux mysql backup script you can do your easy mysql backup by menu-driven user inputs.
linux, bash, mysql (http://dev.mysql.com/downloads/).
a backup user with backup-privileges.
Use the following command for creating this one:
GRANT PROCESS,SELECT, LOCK TABLES, SHOW VIEW, EVENT, TRIGGER
IDENTIFIED BY ‚BackupPassword‘;
how to call the script for backup for mysql database:
bash easymysqlbackup or ./easymysqlbackup
how to use script for backup mysql:
with this simpl script you have 2 options.
1.) You can only show your available databases
2.) You can choose one or more databases to backup.
before the backup mysql will start, the script show you the command that will be execute (see next screenshot).
You can use this as a template for sheduling a automatic backup in the crontab.
For advanced users:
In the mysqldump backup script you can change following default settings:
The MYSQLUSER and the MYSQLPW Parameter are equal to the user / password we created at the beginning.
If you already have an user in your database or you want to use the root user (not recommended) you can set the data here.
The DATABASE_BACKUP_DIR is the default backup directory for the database. You can change the path in the script but you also can change it during the backup-process. DATABASE_BACKUP_FILE is the filename for the backupfile which contains the current date and time. Feel free to change it, if you want ;).
Attention: The author does not assume liability for errors or data loss!