创建数据库
create database test DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
添加用户
create user 'cjh'@'%' identified by '123456';
用户授权
grant all privileges on `testdb`.* to 'test'@'%' identified by '123456'; flush privileges;
密码安全策略
mysql> SHOW VARIABLES LIKE 'validate_password%';
validate_password_policy有以下取值:
Policy | Tests Performed |
---|---|
0 or LOW |
Length |
1 or MEDIUM |
Length; numeric, lowercase/uppercase, and special characters |
2 or STRONG |
Length; numeric, lowercase/uppercase, and special characters; dictionary file |
默认是1,即MEDIUM,所以刚开始设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。
设置成你想要的安全策略
set global validate_password_length=0;
设置密码
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
删除外键冲突的记录
DELETE e.* FROM yl_cloud_std_demo.role_menu e WHERE id IN ( SELECT t.id FROM ( SELECT a.id FROM yl_cloud_std_demo.role_menu a LEFT JOIN yl_common.menu b ON a.menu_code = b.menu_code WHERE b.menu_code IS NULL ) t )
转载请注明博客出处:http://www.cnblogs.com/cjh-notes/