Mysql函数
加密密码
select password(‘123456’);
md5加密密码(貌似mysql数据库相同密码每次加密后的md5字符串都是一样)
select md5(‘123456’);
select AES_ENCRYPT(‘123456’,’key’) ; #加密
select AES_DECRYPT( ( select AES_ENCRYPT(‘123456’,’key’) ),’key’) ; #解密
select encode(‘123456’,’qwedgnkh’); #加密
select decode(encode (“‘123456’”,“‘qwedgnkh’”),“‘qwedgnkh’”) #解密
select charset(‘string’),charset(convert(‘string’ using latin1)); #改变字串的默认字符集
使用数学函数rand()生成3个10以内的随机整数
select round(rand() * 10) , round(rand() * 10) , round(rand() * 10) ;
使用函数计算三角函数
select pi() ,sin( pi()/2 ) ,cos( pi() ),round( tan(pi()/4) ),floor( cot(pi()/4) );
获得当前日期+时间(date + time)函数:now()
select now() ;
获得当前时间戳函数
select current_timestamp();
函数:date_format(date,format), time_format(time,format)
select date_format(‘2008-08-08 22:23:01’,’%Y%m%d%H%i%s’);
select time_format(‘2008-08-08 22:23:01’,’%Y%m%d%H%i%s’);