Need help in backing up of databases.


Jan 16, 2012
cPanel Access Level
Root Administrator
Hi Everyone,

I am new to DBA stuff. I wonder if anyone can help me. Task is that, I have 10 databases and need to take backups of all the databases using data pump in Unix/Linux, compress them using gzip and use cron to schedule the job twice a day.

Appreciate if anyone can help me in this. I was trying this for a week but no luck.



Quality Assurance Analyst
Staff member
Oct 2, 2010
somewhere over the rainbow
cPanel Access Level
Root Administrator
What have you done so far command wise so we know what parts are and are not working?


Well-Known Member
Apr 30, 2003
Washington Court House, Ohio, United States
cPanel Access Level
DataCenter Provider
Well - backing up one time is pretty simple - as long as you know your mysql user/pass (depending on your setup you may not need that from the command line either... )

To backup a single database via SSH - simply do the following @ the command line (cli)

mysqldump --add-drop-table -u db_username -p db_name > mybackup.sql
(Omit the –add-drop-table argument if you’ll want to merge this backup with an existing database upon restore)
(Replace db_username with the name of your database user )
(Replace db_name with the name of your database )
(Replace mybackup.sql with the name of your backup file )

Another alternative would be to do each together - I have used this in the past - and simply set to perform daily via a cron job

* * * * * mysqldump -u root -pPASSWORD --all-databases | gzip > /filepathhere/database_`data '+%m-%d-%Y'`.sql.gz

of course you could always run that from the command line as well - be sure to change the /filepathhere/ to where you want it to go.

Now - If you are looking for a much better backup approach however I suggest using a script called AutoMySQLBackup has all the features most need:

1. simple database backup
2. multiple database backups
3. ability to compress (gzip or bzip2) the backups to save on storage
4. rotate backups to save space and cut down on old garbage.
5. email when done/ logs etc ...

The installation is very simple: just download the one file bash script and save it somewhere, customize it to fit your setup (only some basic changes are needed: like the MySQL user and password, backup location), make it executable and activate it in cron as needed (daily for example).

Check out the FREE project on sourceforge AutoMySQLBackup | Free software downloads at