共计 2754 个字符,预计需要花费 7 分钟才能阅读完成。
通过 phpMyAdmin,创建 procedure,用于生成测试数据。
随机的用户名及手机号。
DELIMITER $$
CREATE PROCEDURE `sp_insert_test_users`(IN `para_count` INT)
BEGIN
DECLARE p_username varchar(50);
DECLARE p_countryCallingCode varchar(10) default ’86’;
DECLARE p_phone varchar(20);
DECLARE p_all_phone varchar(20);
DECLARE p_create_time datetime;
DECLARE p_index int default 0;
DECLARE p_userid int default 0;
IF para_count > 0 THEN
SET p_create_time = NOW();
while p_index < para_count do
select concat(
substring(‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’, rand()*26 , 1),
substring(‘abcdefghijklmnopqrstuvwxyz’, rand()*26 , 1),
substring(‘abcdefghijklmnopqrstuvwxyz’, rand()*26 , 1),
substring(‘abcdefghijklmnopqrstuvwxyz’, rand()*26 , 1),
substring(‘abcdefghijklmnopqrstuvwxyz’, rand()*26 , 1),
substring(‘abcdefghijklmnopqrstuvwxyz’, rand()*26 , 1),
substring(‘abcdefghijklmnopqrstuvwxyz’, rand()*26 , 1),
substring(‘abcdefghijklmnopqrstuvwxyz’, rand()*26 , 1)
) into p_username;
select concat(
‘139’,
substring(‘1234567890’, rand()* 10 , 1),
substring(‘1234567890’, rand()* 10 , 1),
substring(‘1234567890’, rand()* 10 , 1),
substring(‘1234567890’, rand()* 10 , 1),
substring(‘1234567890’, rand()* 10 , 1),
substring(‘1234567890’, rand()* 10 , 1),
substring(‘1234567890’, rand()* 10 , 1),
substring(‘1234567890’, rand()* 10 , 1)
) into p_phone;
if not exists (select 1 from users where username = p_username or phone = p_phone)
and length(p_username) = 8 and length(p_phone) = 11
then
set p_all_phone = concat(p_countryCallingCode,’;’,p_phone);
INSERT INTO `users`
(`username`, `countryCallingCode`, `phone`, `_phone`,
`group`, `created_at`, `updated_at`)
VALUES
(p_username,p_countryCallingCode,p_phone,p_all_phone,
‘user’, p_create_time, p_create_time);
select @@IDENTITY into p_userid;
INSERT INTO `users_test_mock`
(`userid`,`username`, `countryCallingCode`, `phone`)
VALUES
(p_userid,p_username,p_countryCallingCode,p_phone);
SET p_index = p_index + 1;
end if;
end while;
END IF;
END$$
DELIMITER ;
调用:
call sp_insert_test_users(10);
LAMP 架构协同应用的实例——phpMyAdmin https://www.linuxidc.com/Linux/2013-07/87645.htm
LAMP 应用之 phpMyAdmin、Wordpress https://www.linuxidc.com/Linux/2013-04/82757.htm
phpMyAdmin 老出现登陆超时解决方法 https://www.linuxidc.com/Linux/2012-09/70715.htm
Ubuntu 16.04 安装 phpMyAdmin 数据库管理工具 https://www.linuxidc.com/Linux/2016-11/137483.htm
Ubuntu 安装 phpMyAdmin 与 Adminer https://www.linuxidc.com/Linux/2012-08/69419.htm
在 LAMP 基础上实现 SSL 功能并安装 phpMyAdmin https://www.linuxidc.com/Linux/2012-07/66905.htm
Ubuntu 14.04 配置 LAMP+phpMyAdmin PHP(5.5.9) 开发环境 https://www.linuxidc.com/Linux/2014-10/107924.htm
CentOS 7.3 下 phpMyAdmin 安装部署 https://www.linuxidc.com/Linux/2017-08/146018.htm
phpMyAdmin 的详细介绍 :请点这里
phpMyAdmin 的下载地址 :请点这里
: