1. 解决mysql 登录不了,或者初始化登录不了
1.1 先停止mysql 服务 , service mysqld stop
1.2 跳过密码验证,/usr/bin/mysqld_safe --skip-grant-tables
1.3 随便登录
1.4 set global read_only=0; flush privileges; // 关闭主库只读属性
1.5 授权, grant all privileges on *.* to 'root'@'localhost' identified by 'root' with grant option;
1.6 set global read_only=1; flush privileges;
1.7 重启服务, 重新登录
https://blog.csdn.net/hhj724/article/details/73277506
2.解决密码策略问题
set global validate_password_policy=0;
set global validate_password_length=1;
https://www.cnblogs.com/ivictor/p/5142809.html
3.MySQL 延迟更新索引
https://blog.csdn.net/leyangjun/article/details/46275483
1.mysql 初次安装,密码问题
1.mysql5.7会生成一个初始化密码,而在之前的版本首次登陆不需要登录。
在 /var/log/mysqld.log 找下面一句话,临时密码就在里面
2018-10-22T15:40:57.268493Z 1 [Note] A temporary password is generated for root@localhost: n3je*1vrGfF7
2.使用这个 root 账户的密码进入mysql
step 1: SET PASSWORD = PASSWORD(“new password”);
step 2: ALTER USER ‘root‘@‘localhost‘ PASSWORD EXPIRE NEVER;
step 3: flush privileges;
3.退出重启
2.如果密码太简单会报下面的错误
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
set global validate_password_length=1;
set global validate_password_policy=0;