[转载]Back up all of your mysql databases nightly
原文地址:http://www.linuxbrigade.com/back-up-all-of-your-mysql-databases-nightly/
Put the following into something like /usr/local/bin/mysql_backup.sh and since it has MySQL’s root password in it, make sure that you chmod 700 to it so no one else can read it.
#!/bin/bash DB_BACKUP="/backups/mysql_backup/`date +%Y-%m-%d`"
DB_USER="root"
DB_PASSWD="secretttt"
HN=`hostname | awk -F. '{print $1}'` # Create the backup directory
mkdir -p $DB_BACKUP # Remove backups older than days
find /backups/mysql_backup/ -maxdepth -type d -mtime + -exec rm -rf {} \; # Backup each database on the system
for db in $(mysql --user=$DB_USER --password=$DB_PASSWD -e 'show databases' -s --skip-column-names|grep -viE '(staging|performance_schema|information_schema)');
do mysqldump --user=$DB_USER --password=$DB_PASSWD --events --opt --single-transaction $db | gzip > "$DB_BACKUP/mysqldump-$HN-$db-$(date +%Y-%m-%d).gz";
done
By the way, we’re skipping tables ‘performance_schema’ and ‘information_schema’…
Then just call it from cron by creating a root cron entry:
* * * /usr/local/bin/mysql_backup.sh
(完)
[转载]Back up all of your mysql databases nightly的更多相关文章
- MySQL: How to support full Unicode in MySQL databases
How to support full Unicode in MySQL databases Published 30th July 2012 · tagged with MySQL, securit ...
- 转载的在DOS下操作mysql
转载原文地址:http://www.server110.com/mysql/201309/1070.html 一.连接MYSQL. 格式: mysql -h主机地址 -u用户名 -p用户密码 1.例1 ...
- 【转载】在使用JDBC连接MySql时报错:You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support
在使用JDBC连接MySql时报错:You must configure either the server or JDBC driver (via the serverTimezone config ...
- [转载]centos7 快速安装 mariadb(mysql)
http://blog.csdn.net/default7/article/details/41973887 从最新版本的linux系统开始,默认的是 Mariadb而不是mysql! yum ins ...
- 【转载】LVS+MYCAT+读写分离+MYSQL主备同步部署手册(邢锋)
LVS+MYCAT+读写分离+MYSQL主备同步部署手册 1 配置MYSQL主备同步…. 2 1.1 测试环境… 2 1.2 配置主数据库… 2 1.2.1 ...
- (转载)Linux下安装配置MySQL+Apache+PHP+WordPress的详细笔记
Linux下安装配置MySQL+Apache+PHP+WordPress的详细笔记 Linux下配LMAP环境,花了我好几天的时间.之前没有配置过,网上的安装资料比较混乱,加上我用的版本问题,安装过程 ...
- [转载自阿里丁奇]各版本MySQL并行复制的实现及优缺点
MySQL并行复制已经是老生常谈,笔者从2010年开始就着手处理线上这个问题,刚开始两三年也乐此不疲分享,现在再提这个话题本来是难免"炒冷饭"嫌疑. 最近触发再谈这个话题,是 ...
- 【转载】通过sql server 连接mysql
http://www.cnblogs.com/goole/p/5291286.html 1.在SQL SERVER服务器上安装MYSQL ODBC驱动; 驱动下载地址:http://dev.mysql ...
- (转载)Unity3D连接本地或局域网MySQL数据库
准备工作: 1.打开 Unity3D 安装目录,到这个路径下 Editor > Data > Mono > lib > mono > 2.0 拷贝出下图的五个动态链接库, ...
随机推荐
- Oracle之ORDER BY
------------基本查询--1.查询出的是一张虚拟的结果表-----基本语法---- * 所有列(字段)select * from emps; -----查询指定字段select employ ...
- 使用Django建立网站
# django-admin startproject csvt01 # cd csvt01 # django-admin startapp blog # vim csvt01/settings.py ...
- JUnit操作指南-批量执行单元测试(将多个测试类捆绑在一起执行)
相关链接:https://github.com/junit-team/junit4/wiki/Aggregating-tests-in-suites
- 数据迁移工具sqoop
有问题........数据迁移工具sqoop sqoop安装 [root@sqoop data]# wget wget http://apache.fayea.com/sqoop/1.4.6/sqo ...
- Ubuntu下查看机器信息
原文地址 测试机器的硬件信息 查看CPU信息(看到有8个逻辑CPU, 也知道了CPU型号) # cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq ...
- GPS部标平台的架构设计(五)-地图服务算法库
GPS平台,需要和各种地图打交道,需要解决以下的问题: 1.坐标偏移,这个不用多说,需要将原始坐标加偏,然后在百度地图或谷歌上显示出来,需要注意的是百度地图的加偏是偏上再偏,谷歌.高德地图等是火星坐标 ...
- Design and Analysis of Algorithms_Brute Froce
I collect and make up this pseudocode from the book: <<Introduction to the Design and Analysis ...
- web前端基础知识- Django基础
上面我们已经知道Python的WEB框架有Django.Tornado.Flask 等多种,Django相较与其他WEB框架其优势为:大而全,框架本身集成了ORM.模型绑定.模板引擎.缓存.Sessi ...
- Last time, I wrote a pager, but now it seems this no longer has use, so I want to paste it here.
public class Pager<T> where T : new() { private IEnumerable<T> _all; private IEnumerable ...
- c++友元函数
c++友元函数分两类: 一://友员全居函数 /*#include <iostream>using namespace std;class aaa{ friend void prin ...