Home > Database > Mysql Tutorial > Mysql完全备份_MySQL

Mysql完全备份_MySQL

WBOY
Release: 2016-06-01 13:47:07
Original
893 people have browsed it

bitsCN.com 1.查看mysql上都有哪些库
mysql> show databases G
*************************** 1. row ***************************
Database: information_schema
*************************** 2. row ***************************
Database: mysql
*************************** 3. row ***************************
Database: test
  3 rows in set (0.00 sec)
2.执行完全备份
  sh back.sh
  back.sh
  #!/bin/sh
export back_dir=/data/bak
export pass="123"
export mysql_dir=/usr/local/mysql-5.1.56
for i in $(mysql -uroot -p$pass -e show databases G | grep Database | cut -d: -f2)
  do
  $mysql_dir/bin/mysqldump --opt $i -p$pass --skip-lock-tables>$back_dir/$i.$(date +%Y%m%d).sql
done
 #use fetion to notice dba
  LD_LIBRARY_PATH=/usr/lib  /usr/local/fetion/fetion  --mobile=159xxxx3240 --pwd=123456 --to=159xxxx3240 --msg-utf8=mysql backup is     success !
3.计划任务
 crontab -e
 0 3 * * * sh /usr/bin/back.sh bitsCN.com

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template