Backing Up your Mysql Database

in #mysql7 years ago

256-MySQL-Backup.jpg

Hello everyone,

I'll be talking today about backing up your database, once we have our databases in production is never safe to leave it in production servers as you never know what can happen so therefore backups are essential. The best process is that you do not need to do this stuff everyday manually to upload to your local computer or to your favourite cloud storage.

I would like to share a script that still today i use to backup everyday my databases into Google Drive, Why Google Drive? You can pretty much use any cloud storage , the good thing about Google Drive is you have available 30 GB for free to store your files. The script is a simple bash script that runs on a cron job that you can set every day at specific time to be executed.

How it works is pretty much doing a dump from mysql database into a directory on your server using mysqldump and send it to your google drive so you can have your files safely stored and available at any time when you require.

Very important , when using mysqldump please note that this process while exporting your database it will lock your database until it finishes so it's very important you decide to export on a time where you don't have so much usage on your database , if this is a problem for you i recommend to use xtrabackup from Percona.

Also when you do backups of your database never leave on a public directory that can be accessible by anyone, make sure to use like a root directory preferable where only you have access.

Below you can find the bash script in github and feel free to use and modify as you wish:
https://github.com/wipeskim/mysqlbackupGdrive/blob/master/README.md

All the best !

Coin Marketplace

STEEM 0.19
TRX 0.25
JST 0.038
BTC 97484.70
ETH 3417.93
USDT 1.00
SBD 3.04