工作随笔-mysql

 

 

 ======================================

1:如何找回mysql的数据

用repair table能够找回绝大多数的数据,但还是有部分有错误的记录(这些记录都是在copy数据文件的时候正在读写的记录)在修复时被直接删除了。所以,我认识到我们这种备份的方式存在隐患。
 
查阅了mysql的文档,看到文档中记录了两种安全备份的方法:
 
1. mysqlhotcopy
这个命令会把数据库里的表都锁住,然后再拷贝文件,保证数据的完整性。命令的使用方法是:
mysqlhotcopy -u root -p<rootpass> db1 db2 ... dbn <output_dir>
如果需要备份全部数据库,可以加上--regexp=".*"参数。
这个命令会在拷贝文件之前会把表锁住,并把数据同步到数据文件中,以避免拷贝到不完整的数据文件,是最安全快捷的备份方法。
优点:速度快
缺点:只能用于MyISAM格式的数据库;必须拥有数据库访问权限
 
2. mysqldump
这个命令是用来把数据库倒成sql文件的,是非常古老的命令了。但因为一直以来都觉得这个命令产生的sql文件对blob数据的支持不是很好,而咱们的数据库大多都有blob,所以不怎么喜欢它。其实,现在才知道,只要加上一个简单的参数就可以解决blob的问题:
mysqldump -u root -p<rootpass> --hex-blob db1 > db1.sql
加上--hex-blob参数以后,blob数据会被类似BASE64的方法转换为文本来存储在sql文件中,就不会导致sql文件格式问题了。经过我测试,通过这种方法备份的blob数据再重新恢复回去能够完全正确。
如果要备份所有的数据库,可以加上--all-databases参数。
优点:可以用于任何格式的数据库
缺点:速度慢,输出结果文件较大;必须拥有数据库访问权限
 
对于没有使用InnoDB的数据库,用mysqlhotcopy是最好的方法;否则必须采用mysqldump。不论如何,直接拷贝文件的备份方法应该被废弃了。
===============================================
鼠标经过图片,鼠标指向图片,如何改变透明度呢?

第一:初始半透明,鼠标经过不透明的代码

1
2
3
style="opacity:0.4;filter:alpha(opacity=40)"
onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100"
onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=40;"

第二:初始不透明,鼠标经过变透明的代码

1
2
3
style="opacity:1;filter:alpha(opacity=100)"
onmouseover="this.style.opacity=0.4;this.filters.alpha.opacity=40"
onmouseout="this.style.opacity=1;this.filters.alpha.opacity=100;"

以上两种代码经测试完全有效,透明度参数可以自己调整!!

测试通过。效果很好。

 ===========================================

鼠标经过图片翻转

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>仿当当网鼠标经过图片翻转jquery特效</title>
<style type="text/css">
<!--
body,h1,h2,h3,h4,h5,h6,p,ul,ol,li,form,img,dl,dt,dd,table,th,td,blockquote,fieldset,div,strong,label,em{margin:0;padding:0;border:0;}
ul,ol,li{list-style:none;}
input,button{margin:0;font-size:12px;vertical-align:middle;}
body{font-size:12px;font-family:Arial, Helvetica, sans-serif; text-align:center; margin:0 auto;}
table{border-collapse:collapse;border-spacing:0;}

.clearfloat{height:0;font-size:1px;clear:both;line-height:0;}

#container{ width:960px; text-align:left; margin:0 auto; }
a{color:#333;text-decoration:none;}
a:hover{color:#ef9b11; text-decoration:underline;}

.layout_main{ width:728px; margin:20px auto;}
.content_bottom UL LI {FLOAT: left}
.content_bottom UL LI.brand_item {WIDTH: 182px; HEIGHT: 182px}
.brand_item A {DISPLAY: block; WIDTH: 168px; HEIGHT: 169px}
.brand_item A:hover {TEXT-DECORATION: none}.brand_item A.brand_name {BORDER-RIGHT: #b69d6b 1px solid; BORDER-TOP: #b69d6b 1px solid; BORDER-LEFT: #b69d6b 1px solid; BORDER-BOTTOM: #b69d6b 1px solid}.brand_item A.brand_detail {BORDER-RIGHT: #daa900 2px solid; BORDER-TOP: #daa900 2px solid; BORDER-LEFT: #daa900 2px solid; BORDER-BOTTOM: #daa900 2px solid}.brand_item A SPAN {DISPLAY: block; MARGIN-LEFT: 1px; WIDTH: 166px; PADDING-TOP: 10px; HEIGHT: 20px; TEXT-ALIGN: center}A.brand_name SPAN {COLOR: #7f5400; BACKGROUND-COLOR: #e0dbcd}A.brand_detail SPAN {COLOR: #fff; BACKGROUND-COLOR: #8d5303}--></style><SCRIPT src="js/jquery.min.js"></SCRIPT><SCRIPT type=text/javascript> $(document).ready(function(){ // 判断img轮转,实现a跳转// 推荐品牌滑动翻转效果 brandPicTurn(); }); function brandPicTurn(){ $(".brand_detail").hide(); $(".brand_item").hover( function(){ $(this).children(".brand_name").hide(); $(this).children(".brand_detail").show(); } , function(){ $(this).children(".brand_detail").hide(); $(this).children(".brand_name").show(); } ); }</SCRIPT></head><body><DIV class="layout_main"> <DIV class="content_bottom" > <UL class="ui_brands"> <LI class=brand_item> <A class="brand_name" href="#" target=_blank> <IMG src="images/pic_jy_name.gif"> <SPAN>九阳 Joyoung</SPAN> </A> <A class="brand_detail" href="#" target=_blank> <IMG src="images/pic_jy_product.gif"> <SPAN>九阳 Joyoung</SPAN> </A> </LI> <LI class=brand_item> <A class="brand_name" href="#" target=_blank> <IMG src="images/pic_sx_name.gif"> <SPAN>三星 Samsung</SPAN> </A> <A class="brand_detail" href="#" target=_blank> <IMG src="images/pic_sx_product.gif"> <SPAN>三星 Samsung</SPAN> </A> </LI> <LI class=brand_item> <A class="brand_name" href="#" target=_blank> <IMG src="images/pic_oly_name.gif"> <SPAN>欧莱雅 LOREAL</SPAN> </A> <A class=brand_detail href="#" target=_blank> <IMG src="images/pic_oly_product.gif"> <SPAN>欧莱雅 LOREAL</SPAN> </A> </LI> <LI class=brand_item> <A class=brand_name href="#" target=_blank> <IMG src="images/pic_jn_name.gif"> <SPAN>佳能 Cannon </SPAN> </A> <A class=brand_detail href="#" target=_blank> <IMG src="images/pic_jn_product.gif"> <SPAN>佳能 Cannon </SPAN> </A> </LI> </UL> </DIV></DIV><div style="clear:both"></div></body></html>

 

 

posted @ 2014-12-26 14:03  whb67  阅读(285)  评论(0编辑  收藏  举报