Can I make a regular MySQL backup on timestamp

Asked By 10 points N/A Posted on -
qa-featured

Is it possible not to overwrite an existing file using a ZIP file when making a regular backup and putting it on XYZ.com/dbbackup/ location? 

Would a PHP script do this? 

Can I make a regular Mysql backup on timestamp?

SHARE
Best Answer by Coreyo Dallas
Best Answer
Best Answer
Answered By 0 points N/A #155316

Can I make a regular MySQL backup on timestamp

qa-featured

Yes it is possible not to overwrite an existing file while making a regular Mysql Database backup into compressed gzip file.

In order to do this you need to avoid using similarly named file paths when you are executing the mysqldump command.

Have different file names for each gzip file so that the new gzip file does not overwrite an original gzip file with the same name.

The mysqldump is the command used to backup mysql databases with very large amounts of data.

You can use the mysql backup command given here and pipe the output to gzip, then the output will be a compressed gzip file.

$ mysqldump – u [uname] -p[pass] [dbname] | gasp – 9 > [backupfile.sql.gz]

I hope this helps.

Answered By 0 points N/A #155317

Can I make a regular MySQL backup on timestamp

qa-featured

Hello,

The safest starting step is to use mysqlbackup to backup and restore a database.
 
Mysqlbackup command will back up the innoDB tables and the indexes, MyISAM tables and the indexes or any .frm files.
 
To apply changes to your backup use the following commands: 
 
mysqlbackup –user=dba –password –port=3306  –with-timestamp –backup-dir=/export/backups  backup
 
mysqlbackup –defaults-file=/usr/local/mysql/my.cnf backup
 
–compress –user=backupadmin –password –port=18080  backup
 
P.S. Grant permissions to the user working on mysql server in order to enable this user to execute mysqlbackup commands.
For the first command: — user and the — password connects the user to the MySQL server.
For the second command: use a configuration file.
For the third command: use — with – timestamp to define the backup sub-directory. 
 
I hope this is useful.

Related Questions