首页 > 数据库技术 > 详细

mysql 中用户默认密码加密问题

时间:2017-06-08 11:42:31      阅读:387      评论:0      收藏:0      [点我收藏+]

问题描述:

在mysql中 user表中新增用户默认密码为123456,但是在数据库中显示不能为明文,而mysql的默认字段不能用函数

解决方法:

用触发器

delimiter |
drop trigger if exists default_user_pwd;
create trigger default_user_pwd before insert on user 
for each row
if (new.pwd is null or new.pwd =‘‘ or new.pwd =‘123456‘ )then
set new.pwd = ENCODE(‘123456‘,‘password‘);
end if;|

 

使用范围

可以检测某些值是否null 或者为空

 

mysql 中用户默认密码加密问题

原文:http://www.cnblogs.com/a9999/p/6961954.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!