加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

MYSQL数据库MySQL 随机密码生成代码

发布时间:2020-12-12 02:58:19 所属栏目:MySql教程 来源:网络整理
导读:《MYSQL数据库MySQL 随机密码生成代码》要点: 本文介绍了MYSQL数据库MySQL 随机密码生成代码,希望对您有用。如果有疑问,可以联系我们。 DELIMITER $$ CREATE FUNCTION `t_girl` . `func_rand_string` ( f_num tinyint unsigned,f_type tinyint unsigned )

《MYSQL数据库MySQL 随机密码生成代码》要点:
本文介绍了MYSQL数据库MySQL 随机密码生成代码,希望对您有用。如果有疑问,可以联系我们。


DELIMITER $$

CREATE
FUNCTION `t_girl` . `func_rand_string` ( f_num tinyint unsigned,f_type tinyint unsigned )
RETURNS varchar ( 32)
BEGIN
-- Translate the number to letter.
-- No 1 stands for string only.
-- No 2 stands for number only.
-- No 3 stands for combination of the above.
declare i int unsigned default 0;
declare v_result varchar ( 255) default '' ;
while i < f_num do
if f_type = 1 then
set v_result = concat ( v_result,char ( 97+ ceil( rand ( ) * 25) ) ) ;
elseif f_type= 2 then
set v_result = concat ( v_result,char ( 48+ ceil( rand ( ) * 9) ) ) ;
elseif f_type= 3 then
set v_result = concat ( v_result,substring ( replace ( uuid ( ),'-','' ),i+ 1,1) ) ;
end if;
set i = i + 1;
end while;
return v_result;

END $ $

DELIMITER ;

编程之家PHP培训学院每天发布《MYSQL数据库MySQL 随机密码生成代码》等实战技能,PHP、MYSQL、LINUX、APP、JS,CSS全面培养人才。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读