Mysql数据备份以及异地存储
整理tuscany.org.cn的服务器,发现3年前写的脚本还在跑着 :)
脚本如下:
#==========================================================
#!/bin/bash
current_date=`date +%Y-%m-%d:%H:%M:%S`
/usr/local/mysql/bin/mysqldump -prootpass dbname1 > ./DB_DIR/dbname1_"$current_date"_dump_file.sql
/usr/local/mysql/bin/mysqldump -prootpass dbname2 > ./DB_DIR/dbname2_"$current_date"_dump_file.sql
scp /root/DB_DIR/dbname1_"$current_date"_dump_file.sql sca@172.90.91.92:/root/DBBakDir
scp /root/DB_DIR/dbname2_"$current_date"_dump_file.sql sca@172.91.92.93:/root/DBBakDir
if [ $? -ne 0 ]
then
mail -s "Warning mesage from the automating backup program of tuscany.org.cn" wanghongwei@myce.net.cn < mailcontext.txt
fi
#==========================================================
mailcontext.txt的内容
==================================
Tuscany数据备份出错,请尽快查看原因并解决!
相关文档:
1.创建一个java project项目pooling
2.为项目添加MySQL连接驱动
3.为项目添加一个配置文件dbpool.proprerties
Code
driverClassName=com.mysql.jdbc.Driver
username=root
password=
url=jdbc:mysql://localhost:3306/work
poolSize=10
4.分别创建一个连接类ConnectionPool.java和一个测试类ConnectionPoo ......
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体" ......
所有的数学函数在一个出错的情况下返回NULL。
-
单目减。改变参数的符号。
mysql> select - 2;
注意,如果这个操作符与一个BIGINT使用,返回值是一个BIGINT!这意味着你应该避免在整数上使用-,那可能有值-2^63!
ABS(X)
返回X的绝对值。
mysql> select ABS(2);&n ......
drop table student;
create table student
(sno int not null unique,
sname varchar(8) not null,
ssex char(2) not null,
sage int ,
sdept varchar(20));
select * from student;
alter table student drop uniq ......
Backup and Restore MySQL Database Using mysqldump
by Ramesh Natarajan on September 22, 2008ShareThis
[mysqldump - MySQL Backup & Restore]mysqldump is an effective tool to backup MySQL database. It creates a *.sql file with DROP table, CREATE table and INSERT into sql-statements of the source ......