MySQL常用命令记录
创建数据库
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/
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步