removesensitiveinformationplan.sh
#!/bin/sh #!在模拟库上运行如下脚本 #!生产库crm-db #!模拟库crm-mock #!1.备份生产库 mysqldump -uroot -proot -hcrm-db crm >crm.sql #!2.还原到模拟库 #!注意:密码中有如下特殊字符&,可能需要转义。 mysql -ucrmadmin -pY&ASB crm < crm.sql #!3还原到模拟库 mysql -ucrmadmin -pY&ASB crm < removesensitiveinformationplan.sql #!4.备份模拟库分发给CRM组开发人员 mysqldump -uroot -proot -hcrm-mock crm >crm-mock.sql
removesensitiveinformationplan.sql
-- 更新新客户信息中的手机号_邮箱_微信_QQ_etc SELECT @rowno := 0; update customer set customer.`name` = CONCAT('客户名称',(@rowno := @rowno + 1)), customer.phone = 13000000000 + (@rowno := @rowno + 1), customer.office_phone = 18000000000 + (@rowno := @rowno + 1), customer.tele_phone = CONCAT('010-0',1000000 + (@rowno := @rowno + 1)), customer.email = CONCAT(1000000 + (@rowno := @rowno + 1),'@qq.com'), customer.media_q = 201000000 + (@rowno := @rowno + 1), customer.media_wechat = 881000000 + (@rowno := @rowno + 1); COMMIT;