Development

10 Ways to Automatically & Manually Backup MySQL Database

March 15th, 2009

MySQL is one of the most popular open source database management system for the development of interactive Websites.

If your site stores its sensitive data in a MySQL database, you will most definitely want to backup that information so that it can be restored in case of any disaster (we all have been there).

There are several ways to backup MySQL data. In this article we’ll look at how to backup your databases using different methods, we will also learn how to achieve an automatic backup solution to make the process easier. Starting with the mysqldump utility that comes with MySQL, we will review several examples using mysqldump, including the backup of your database to a file, another server, and even a compressed gzip file and send it to your email.

1. Automatically backup mysql database to Amazon S3

MySQL Backup Solution

Many of users use Amazon S3 to backup their mysql databases. Here is an automated script which does this task of taking the backup of a mysql database and then moving it to the Amazon S3.

2. How to Backup MySQL Database automatically (for Linux users)

15 2 * * * root mysqldump -u root -pPASSWORD --all-databases | gzip > /mnt/disk2/database_`data ' %m-%d-%Y'`.sql.gz 

This post will show you how to backup MySQL Database automatically if you are a linux user. You can use cron to backup your MySQL database automatically.”cron” is a time-based scheduling utility in Unix/Linux
operating system.

3. Backup your MySQL databases automatically with AutoMySQLBackup

AutoMySQLBackup has some great features to: backup a single database, multiple databases, or all the databases on the server; each database is saved in a separate file that can be compressed (with gzip or bzip2); it will rotate the backups and not keep them filling your hard drive (as normal in the daily backup you will have only the last 7 days of backups, the weekly if enabled will have one for each week, etc.).

4. Backing Up With MySQLDump

mysqldump ---user [user name] ---password=[password]  
[database name] > [dump file]

In this article we’ll look at how to backup our databases using the mysqldump utility that comes with MySQL. Several examples will be reviewed using mysqldump, including the backup of your database to a file,
another server, and even a compressed gzip file.

5. Backup Your Database into an XML File Using PHP

mysqldump ---user [user name] ---password=[password]  
[database name] > [dump file]

Here’s a PHP snippet that outputs your database as XML. XML isn’t the easiest format to restore a table but it can be easier to read.

6. How to – Using PHP To Backup MySQL Database

Execute a database backup query from PHP file. Below is an example of using SELECT INTO OUTFILE query for creating table backup:

<?php
include 'config.php';
include 'opendb.php';

$tableName  = 'mypet';
$backupFile = 'backup/mypet.sql';
$query      = "SELECT * INTO OUTFILE '$backupFile' FROM $tableName";
$result = mysql_query($query);

include 'closedb.php';
?> 

To restore the backup you just need to run LOAD DATA INFILE query like this :

<?php
include 'config.php';
include 'opendb.php';

$tableName  = 'mypet';
$backupFile = 'mypet.sql';
$query      = "LOAD DATA INFILE 'backupFile' INTO TABLE $tableName";
$result = mysql_query($query);

include 'closedb.php';
?>

7. Backup MySQL Database Via SSH

A simple solution to backup your large MySQL databases through SSH. You will need to enable shell access inside your Plesk control panel and use a utility such as PuTTY to log into your server via SSH.

8. How to e-mail yourself an automatic backup of your MySQL database table with PHP

This script will send an e-mail to you with an .sql file attached, thus enabling you to back up specific tables easily. You could even set up an e-mail account just to receive these backups…

9. Ubuntu Linux Backup MySQL server Shell Script

If you have a dedicated VPS server running Ubuntu Linux. Here is how to backup all your mysql server databases to your ftp server

10. How to backup MySQL databases, web server files to a FTP server automatically

This is a simple backup solution for people who run their own web server and MySQL server on a dedicated box or VPS. The main advantage of using FTP or NAS backup is a protection from data loss.First you will need to backup each database with mysqldump command, Automating tasks of backup with tar, Setup a cron job and generate FTP backup script.

$ mysqldump -u root -h localhost -pmypassword faqs | gzip -9 > faqs-db.sql.gz

11. MySQL Export: How to backup your MySQL database?

MySQL Backup Solution

You can easily create a dump file(export/backup) of a database used by your account. In order to do so you should access the phpMyAdmin tool available in your cPanel.

Worth Reading

10 things you need to know about backup solutions for MySQL

Are you using someone else’s backup solution for your MySQL data? Do you care a lot about your data? Are you sure you’re getting a reliable, recoverable backup that’ll work for your business and your application, and won’t impact your critical processes while it runs? Here are ten questions you need to be able to answer.

The jungle is alive: Be it a collaboration between two or more authors or an article by an author not contributing regularly. In these cases you find the Noupe Editorial Team as the ones who made it. Guest authors get their own little bio boxes below the article, so watch out for these.

Tags:

Sort by:   newest | oldest | most voted
xmlsamurai
Guest
xmlsamurai
7 years 6 months ago

Your automatic backup script for Linux will not work, use this instead in the crontab:

15 2 * * * /usr/bin/mysqldump –opt –all-databases -u root -pPASSWORD > /foo/bar/db-`date +%Y-%m-%d`.sql

Sam
Guest
6 years 10 months ago

xmlsamurai As posted here it works fine for me.. Your system must be different or you are doing something wrong. Next time you want to post try using terms like.. It didn’t work for me.. This way you don’t openly say that the instructions is wrong or not working that someone so kindly posted on the web .
I have tested it and it does work.

Matt
Guest
6 years 2 months ago

Your example crontab line has the “data ‘ %m-%d-%Y'” instead of “date ‘ %m-%d-%Y'”. That’s why it doesn’t work.

James W
Guest
James W
5 years 5 months ago

The formatting is a little off. I use the following, which I got from http://www.fortasse.com/tutorials/mysqldump-mysql-database-backup/ :

`date +%m%d%y`

Cherlin
Guest
5 years 3 months ago

Many many quailty points there.

Vivek
Guest
Vivek
7 years 6 months ago
How about using logrotate. Its the best way to keep backup only for X days. Also use rsync to transfer the file to a remote server just for another backup. /var/backups/db.sql.gz { daily rotate 14 nocompress create 640 root adm postrotate mysqldump db -u user -psecret >/var/backups/db.sql rsync -az /var/backups/db.sql –password-file /root/rsync.password remote@server::backup gzip -9f /var/backups/db.sql endscript }
fan of Vivek
Guest
fan of Vivek
6 years 10 months ago

hey Vivek –

I like your method the best. I found /usr/sbin/logrotate is installed by default in OpenSolaris (SXCE b123) so I have found me a “export & retain the last 14” method!

thanks!
C-YA

Scott Jones
Guest
Scott Jones
7 years 6 months ago

I use SQLyog Enterprise. It can connect over SSH and I can schedule my backups. It is not free though :-(

Binny V A
Guest
7 years 6 months ago
alex
Guest
alex
6 years 6 months ago

dear sir,
i am using 2003server as domain and oracle database installed in domain if i do bdc how i can backup every secound from pdc to bdc

insic
Guest
7 years 6 months ago

Nice list list of tips. Number 6 and #7 is handy.

Mani
Guest
7 years 6 months ago

Thank you noupe!! Nice list of resources to be used in different applications.

Willem
Guest
Willem
7 years 6 months ago

This list is incomplete imo, i’d reather see examples of using diff for db backups. This doesnt scale at all.

Matteo
Guest
7 years 6 months ago

Dump a remote db locally in one easy line:

ssh user@server “/usr/bin/mysqldump -u user -p password database_name” | dd of=/where/you/want/the/dump.sql

PS
Guest
PS
7 years 6 months ago

Not a single one of these options will scale past a small to moderately sized database.

Sam
Guest
6 years 10 months ago

PS.
I guess people that doesn’t post their names like to make stupid comments.
The title on this page says “10 Ways to Automatically & Manually Backup MySQL Database”

Not 10 ways to scale.
And you can use some of the methods discussed here to back up very large databases.
These instructions were very good and helpful.

hans
Guest
hans
6 years 4 months ago

I totally agree with you Sam. Sometimes people choose to complain more than to appreciate what has been contributed because they don’t ‘understand’ the article’s title. Anyway, keep up your good work!

Farid Hadi
Guest
7 years 6 months ago

Currently I just use #11 but I’m going to look into #1 and #8.
Thanks for reminding me that I need to figure out a nice way to do this. :)

Ronaldo
Guest
Ronaldo
7 years 6 months ago

Currently I use zmanda mysql backup. I use the comunity version

Peter De Berdt
Guest
Peter De Berdt
7 years 6 months ago

We use version control to backup our database, saving us from having to rotate the dumps. This means we can go back in time as much as we like.

We use Git right now, but any SCM would do actually.

http://pastie.org/417454

You do need to initialize a Git repository at /path/to/dbbackups first. Then add a cron tab that calls the backup script.

Mike
Guest
Mike
4 years 6 months ago
@Peter I love your ‘git’ method. I never would have thought of putting mysqldump and git together. I’m not sure I’ll implement it right now though because I’m spending so much time doing things in a quality way that I am wasting to much time on my business. i.e. I am using a backup system (CrashPlan) while using automysqlbackup. I was using git but the learning curve is a bit steep… however it’s not an option NOT to use a version control system! I’ve also got automated tests (code checker tests, doxygen documentation tests, unit tests, and functional tests via… Read more »
Vinícius
Guest
Vinícius
3 years 10 months ago

I’m pretty curious on what is your conclusion about quality/version control after a while that you wrote this.

Thorsten Strusch
Guest
Thorsten Strusch
7 years 6 months ago

easier:
15 2 * * * /usr/bin/mysqldump –opt –all-databases -u root -pPASSWORD > /foo/bar/db-`date -I`.sql

and with an my.cnf under ~ you dont’t have to write mysqlroots password in your crontab.

john woah
Guest
7 years 6 months ago

if you’re stuck using mySQL…. sorry

Shane
Guest
Shane
7 years 6 months ago

Wow, I was kind of expecting more than just mysqldump, mysqldump, and mysqldump. Has any tried replicating the Mysql DB as a backup solution?

Michael
Guest
5 years 4 months ago
Hey Shane, The biggest issue with MySQLDump is that it locks the database. “For each dumped database, lock all tables to be dumped before dumping them,” from the documentation. The issue with replication is that it’s a mirrored 1:1 copy of your data. If you lose data integrity on your master, your slave is corrupt within seconds. A backup is a snapshot of your data, thus if you replicate snap shots you can not compress and this could become another big issue (and that you’ve now got to find a way to replicate to a destination with multiple copies over… Read more »
ShavenLunatic
Guest
7 years 6 months ago

brilliant. Thanks for a useful list :)

@john woah, what do you have against MySQL?

Rob
Guest
7 years 6 months ago

In many circumstances you would want to force the MYSQL dump to continue past any error with ‘-f’ so that you get the full database even if it contains oddness. Otherwise there is a chance it will crash out and give you only a fraction of your data.

Brandon Darbro
Guest
7 years 6 months ago
My MySql databases are on a hosting provider, here’s the tricks I use. 1) Via ssh, connect to host, issue mysqldump or your dump script(s), have them dump to a non-quota’d location, like /tmp, or /dev/shm (if there’s enough ram on the remote box). My scripts use: -a -Q -q -l –add-drop-table –add-locks –complete-insert -uusername -ppassword database_name > database_name.sql 2) Use rsync over ssh to pull down the dump(s) to the local machine. If you already have an older version of the dump(s), rsync will only transfer what it needs to update your copy. Use compression, too (-z) if you… Read more »
Timothy
Guest
7 years 6 months ago

this is some good information. Thanks

Sarah
Guest
7 years 6 months ago

Wow, I was kind of expecting more than just mysqldump, mysqldump, and mysqldump. Has any tried replicating the Mysql DB as a backup solution??

Kingsly
Guest
Kingsly
7 years 6 months ago

@Sarah

Replication is a HA solution, not a backup solution.

a “delete * from tablename” will wipe out your “backup” too.

Sklep Zoologiczny W?dkarski
Guest
7 years 6 months ago

Thanks! You’re saving my life again ;)

Dainis Graveris
Guest
7 years 6 months ago

I am still rookie in working with databases, very useful.

ez
Guest
7 years 6 months ago

Really cool, I get asked this all the time. We will definably link to your article.

ez
Guest
7 years 6 months ago

The cron for linux is great too, I think I’ll throw that together tonight.

Mithun Sreedharan
Guest
Mithun Sreedharan
7 years 6 months ago

Thank you!

fail
Guest
fail
7 years 6 months ago

none of them are correct. fail.

kissfang
Guest
7 years 6 months ago

actually i scacely use Mysql except in CMS,but CMS sets mySQL already ,

Rahul
Guest
7 years 6 months ago

Nice one. Web developers and admin can use these to backup their online database.

Geo
Guest
7 years 6 months ago

Very useful tips. Automating this process is most ideal. Setting up a cron job would be very useful. Make sure you have proper permissions in performing some of these mysql commands.

SQLyog as mentioned above is a very useful tool but its not free unfortunately.

strony internetowe
Guest
7 years 6 months ago

great stuff

Jeff
Guest
Jeff
7 years 6 months ago

Umm, how about hot backups?

Roy Leonhardt
Guest
7 years 5 months ago

Thank you so much! Excellent!

Timothy
Guest
Timothy
6 years 11 months ago

You can simply use MySQL Administrator to schedule daily backups of all your remote databases. It’s a MySQL product and is free and simple to use.

Abhishek Dilliwal
Guest
6 years 10 months ago

nicely listed… i was not knowing all of them… thanks :)

Assaf
Guest
6 years 10 months ago

Backing up is so important but even more important is to save the backup OUTSIDE the server.

Email can be a good solution for small db but for db larger than 10MB it is better to use third party services

Shahriat Hossain
Guest
6 years 9 months ago

Nice listing though some of them are old but very helpful to bookmark for the future need :)

Martha
Guest
Martha
6 years 8 months ago

I used this info in combo with a script at http://www.fortasse.com/2010/01/tutorials/tutorial-automatic-backup-script/ . It seems to work. After you make the shell script, you can also easily execute it manually or automatically using php shell_exec. Works great.

Daniel Errante
Guest
6 years 7 months ago

I agree with PS, Shane and Sarah…All of these solutions use mysqldump, which can bring your server to a halt while the script is running. For LARGE databases, this could be mean your website going down for a few minutes every day. These solutions are great for smaller databases, but not scaleable if your database has millions of records.

Also, Kingsly. Replication may be an HA solution, but it can also be used to backup the database without interrupting service to your website visitors…

Eric
Guest
Eric
6 years 6 months ago

For god sake people stop using FTP when SFTP is so darned easy to use and automate!

Antone Dever
Guest
6 years 5 months ago

Intimately, the post is really the greatest on this notable topic. I agree with your conclusions and will thirstily look forward to your future updates. Just saying thanks will not just be enough, for the extraordinary clarity in your writing. I will right away grab your rss feed to stay informed of any updates. Admirable work and much success in your business efforts!

Nelson Knisely
Guest
6 years 5 months ago

Comfortabl y, the article is in reality the greatest on this noteworthy topic. I concur with your conclusions and will eagerly look forward to your upcoming updates. Just saying thanks will not just be adequate, for the exceptional lucidity in your writing. I will instantly grab your rss feed to stay privy of any updates. Fabulous work and much success in your business efforts!

Thewriter
Guest
6 years 5 months ago

Fantastic your ability as a copywriter are amazing

Ahmed Pittsley
Guest
6 years 5 months ago

I never knew I would be equipped to jump high so fast. Can anyone gift me anymore suggesstions?

Colin Jensen
Guest
6 years 4 months ago

What a great article! I actually created a script to email me a backup dump of a chosen MySQL database. See it here: http://thephpanswers.com/viewtopic.php?f=13&t=8

I really like this article as you have covered all different options! wish I found it earlier!

Bind
Guest
Bind
6 years 4 months ago
Naster
Guest
6 years 1 month ago

Here is a GUI to auto backup mysql to local path or remote ftp server.

NBackupMySQL :
http://naster.net/index.php?page=scripts&id=7

Plz try and comment ;)

Growl
Guest
Growl
6 years 1 month ago

What is the best way to backup MYSQL so that the tables dont get locked, aka other than mysqldump on a ubuntu server runing mysql?

Drew Q
Guest
Drew Q
5 years 11 months ago

I have been using mysqldump for years now with rather a huge mysql installation. The best improvement I made to avoid downtime during backups due to table locking was to set up a replication server and perform the dump on that. Setting up replication is a whole different animal, but the mysql documentation is good.

linaly
Guest
linaly
6 years 1 month ago

I agree with that.

John C
Guest
6 years 29 days ago

Webmin has a scheduled back up service available which is easy to use / set up. It does not allow for rotation of files (that I can see).

????
Guest
6 years 8 days ago

MajorMUD Control Panel is a PHP website designed.

BEHESHT
Guest
BEHESHT
6 years 2 days ago

Thanks Bro Nice tut…

rai
Guest
rai
5 years 11 months ago

here is a shell script that i’ve created a while ago. It creates a backup daily(needs cron) where you can specify the file’s lifespan. It also includes a monthly archiving every first of the month.

http://bostsip.blogspot.com/2010/10/automated-mysql-backup.html

kranthikiran
Guest
kranthikiran
5 years 11 months ago

How to Take incremental backup using script,please help me

Poster
Guest
5 years 11 months ago

Well I just discovered this site on Google for the first time today. I really think your site is good with excellent articles. Many thanks for the good read. Will add to my Bookmarks.

tommy
Guest
5 years 11 months ago

I always use mysqldump, and send backup to my home server and another backup server. simple and fast.

Akin
Guest
5 years 10 months ago

Very good list of ways to achieve a mysql backup. I personally use mysqldump, will find time to try other. Thanks.

marriage records
Guest
5 years 10 months ago

Great ideas! I used to be having some porblems about what you already stated, Now I shall be higher!

Logan Waston
Guest
5 years 10 months ago

Who knows what happens next… All I know is:

Left to themselves, things tend to go from bad to worse. :)

sinx
Guest
5 years 8 months ago

Hello, I have read your article with interest and most tools described there is using mysqldump+gzip. Also many of this tools doesn’t check return code of mysqldump, which may be very dangerous (as a sysadmin you think you have perfect backup, but it is not true – your backup is corrupted), recently I have written small bash script which do necessary checks, here is the source: MySQL Quick Backup with bash script.

btw: Thanks for info about Auto MySQL Backup tool!

Get Wife Back
Guest
5 years 8 months ago

I watched a system about that on tv at the weekend. With thanks for your extra in-depth explanation

cybermysql
Guest
5 years 7 months ago

There is a new alternative java web application to backup mysql.Here is the link

http://code.google.com/p/mysql-backup-java-webapp/

Krissy Decoteau
Guest
5 years 6 months ago

A relative recommended that I check out your site. I’m happy that I’m here.

OCHotline
Guest
5 years 6 months ago

Great tip, thanks! I was looking for an easy way to do some backups.

John Thompson
Guest
John Thompson
5 years 6 months ago

Some good stuff here, but the author, in #6, doesn’t seem to understand the difference between a database and a table. The title says “Backup a Database” but the technique backs up a table!?

pandu
Guest
pandu
5 years 5 months ago

Thanks dude ….very helpful

swathi
Guest
5 years 5 months ago

Hi,
I am trying to create mysqldump from java program
i write code like this
Runtime.getRuntime().exec(“cmd /c C:/wamp/mysql/bin/mysqldump -u root -p march >C:/backup1.sql”);
file is creating but with zero bytes..
can u give solution for this………

Vince
Guest
5 years 4 months ago

I use this one as it makes backup and restore of all my databases very simple:
http://www.mysqlbackup.info/

songeur
Guest
5 years 4 months ago

Dont forget rsync and rsync over ssh ….
It’s not the best way but fast and easy !

tea lights
Guest
5 years 4 months ago

great

kate
Guest
5 years 4 months ago

Morning. This is enchanting article, guy. Danke. However, Im experiencing weird situation with ur Really Simple Syndication. I have no idea I cannot subscribe to it. Is there anybody having similar rsserror? Cheers

Sandie Kingsley
Guest
5 years 4 months ago

Hello! I just wanted to ask if you ever have any issues with hackers? My last blog (wordpress) was hacked and I ended up losing months of hard work due to no data backup. Do you have any solutions to prevent hackers?

Gabby
Guest
5 years 3 months ago

Why the publish code that now explain what in it
1.include ‘opendb.php’; (where is this file??????????)

Juan C. HORNA
Guest
Juan C. HORNA
5 years 1 month ago

Good Job… your explication is great. It works fine….
greetings.
PD: The point 6 require more detail

rets developer
Guest
5 years 11 days ago

Brilliant Post. I was actually looking for any desktop application that would save FTP details and schedule to run daily, make backup and store at my computer. Any idea? I once found one, but lost !! :(

marthes
Guest
marthes
4 years 11 months ago
Paul G.
Guest
4 years 11 months ago

Hey,

You can automate the backup of your MySQL databases if you’re running cPanel. It finds all your databases and downloads them. The script doesn’t FTP yet, but we’ll release it shortly so that it does.

You can grab it here: http://www.hostliketoast.com/2011/10/cpanel-hosting-full-database-backup-script-free-download/

Cheers!
Paul.

Alejandro Arauz
Guest
Alejandro Arauz
4 years 11 months ago

The article has some good information but it would be better if you mention some tools too, running scripts and creating scheduled tasks manually can be complicated when managing several databases.
I would recommend MySqlBackupFTP (http://mysqlbackupftp.com/) . It is very simple to use and it has a free version that allows you to create scheduled backups.
This tool also has the option to export the backup to an FTP server so you don’t need to run a separate script.

Kimberly
Guest
4 years 10 months ago

Nice tips!
I will try some of them to backup my MySQL.

Polinux
Guest
Polinux
4 years 10 months ago

1 one should be like that

15 2 * * * root mysqldump -u root -pPASSWORD –all-databases | gzip > /mnt/disk2/database_`date +%m-%d-%Y`.sql.gz

Benson
Guest
4 years 8 months ago

most way to backup need root privilege.
Way 6, using php to write a file, don’t work.

Zahid.Pakistan
Guest
Zahid.Pakistan
4 years 7 months ago

I needed a little variant for mysql data dump with single line inserts and no comments and no db create statement. Finally, the following command worked well:

root mysqldump –skip-extended-insert –skip-comments –no-create-info –no-create-db -u root -pgeoware123 iom3_00_04 > /mnt/pcpi/iom3_00_04_data_`date +%m%d%y`.sql

for mysql 5.1 and higher. Hope it helps

smithy
Guest
4 years 7 months ago

does anyone know how to backup changes to the database say once per hour or even better whenever a certain table is updated ie an order?

Rehan Anis
Guest
4 years 7 months ago

here, I have developed this script, which can create backup of virtually any size of database.
Just have a look at it.
dbcare.webcare.pk
And the details are here
http://www.blog.webcare.pk/2012/02/make-backup-of-large-mysql-databases.html

XI
Guest
XI
4 years 5 months ago

There’s another solution that is useful if you have, like me, multiple dbs to backup.
Here: http://www.mysqlsaver.com/

Joe Duncan
Guest
4 years 5 months ago

I use Automatic MySQL Database Backup Plugin. It works with Unix and windows servers and doesn’t use Cron Tabs either. The best part is that it doesn’t backup if nothing has changed which really cuts down on server load since we run a few high traffic sites.

ayan
Guest
4 years 4 months ago

thanks man its really helping

urdesh kumar
Guest
urdesh kumar
4 years 3 months ago

Nice collection for db backup.thanks

harsha
Guest
harsha
4 years 3 months ago

i hav a .csv file when I use the the load data infile it show me that u did syntax error this s not the correct syntax can anyone give me a clear syntax

Omarxp Studio
Guest
4 years 2 months ago

thanks, very helpful, this is what I was looking for.

Sanjay
Guest
4 years 2 months ago

I know best option use phpmyadmin to import and export .

Jason TEPOORTEN
Guest
4 years 2 months ago

Hi,
Thanks VERY much for the helpful link.
I used #2. I changed the date format in the filename to reflect YYYYMMDD_HHMMSS as I find it easier to file sort in a directory simply using the filename.

Here’s an example of the command I use in the root crontab:
mysqldump -u root -pmissMantisBT –all-databases | gzip -9 > /zdbbkp_ecqmantisbt/database_`date ‘+%Y%m%d_%H%M%S’`.sql.gz

I’ll post a FIND command (“please use with care”) that only retains the last seven days of recent files.
Regards,
Jason

Jason TEPOORTEN
Guest
4 years 2 months ago

Hi again,
Sorry for the second post…

Here’s my BASH script that I use to backup all of my mySQL databases on a local Linux (Turnkey LAMP 11.3) host:

#!/bin/bash
# Purpose: Backup all mySQL databases
# Author: Jason TEPOORTEN (JTepoorten@smsmt.com)
mysqldump -u root -pmissMantisBT –all-databases | gzip -9 > /zdbbkp_ecqmantisbt/database_`date ‘+%Y%m%d_%H%M%S’`.sql.gz || exit 1;
find /zdbbkp_ecqmantisbt/ -name ‘*.sql.gz’ -mtime +7 -exec rm -f {} \; || exit 1;
#END

Regards,
Jason

Sakahayang
Guest
4 years 2 months ago

thank you for info,
I like to use a phpMybackup Pro,,,

happy blogging

Rekha_g
Guest
Rekha_g
4 years 1 month ago

thank u but i am not understand u r format, so i request u send the simple format in”how to get the mysql backup”

Adam Gorge
Guest
Adam Gorge
4 years 1 month ago

You can also use Auto Backup for MySQL Professional Edition software to schedule automatic backup which is totally free utility. The software can be used to backup MySQL database from the remote server runs under Any Operating Systems, including Unix, Linux, Mac OS, Windows and all.

Paolo
Guest
4 years 27 days ago

Thank you for the article and for all the post that I can read.
Grazie davvero!

Eric
Guest
4 years 19 days ago

Do any of these solutions work if your data base is hosted externally? e.g. Go Daddy

Liya Gerber
Guest
Liya Gerber
3 years 8 months ago
Noupe, thanks for showing so many MySQL backup solutions! Since this post is over three years old, I’d like to make some suggestions for your next article. Sigh regard to the first option you mentioned, Amazon’s EC2 already has automatic backup. To this, I’d like to add the options offered by the increasingly popular Database-as-a-Solution (DBaaS) solutions, like Amazon’s RDS (http://aws.amazon.com/rds) , and the lesser-known Xeround Cloud Database (http://xeround.com), among others. With Amazon’s RDS, aside from automated backups, you also have what they call “Database (DB) Snapshots”. According to their Website: “DB Snapshots are user-initiated and enable you to back… Read more »
Faisal
Guest
Faisal
3 years 8 months ago

I have created a backup script using Java. and executes it remotely. it successfully creates a .sql file in specified folder.
I wants a post that helps me to taking physical backup automatically. at another location.
Thanks every one for all theses posts. Thanks SAM.

wpDiscuz