首页 > 代码库 > mysql登陆问题
mysql登陆问题
1.centos6下mysql5.7的登陆问题
问题的描述:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)
解决方法:1. 关闭服务 service mysqld stop
2. --skip-grant-tables启动 mysqld_safe --user=mysql --skip-grant-tables
2016-12-16T11:11:07.958205Z mysqld_safe Logging to ‘/var/log/mysqld.log‘. 2016-12-16T11:11:07.963470Z mysqld_safe Logging to ‘/var/log/mysqld.log‘. 2016-12-16T11:11:08.009734Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
3. 登陆命令 mysql -uroot
4. 选择数据库: use mysql
5. 修改密码和host: update user set host=‘%‘ ,authentication_string=password(‘root‘) where user=‘root‘
6. 刷新权限:flush privileges; 注意这一步不要忘记
7. 重启服务:service mysqld restart;
8. 登陆:mysql -uroot -p root
2. mysql5.7密码重置问题
问题描述:ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
问题解决方法:1. 设置密码:set password = password(‘123456‘);
报错:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
原因是MySQL5.6.6增加了密码强度验证插件validate_password,相关参数设置的较为严格密码的长度,
123456不符合mysql的默认密码约束, 如果一定 要用这个密码请修改相关配置,
参考:http://blog.csdn.net/zyz511919766/article/details/12752741
2. 设置密码永不过期: alter user ‘root‘@‘%‘ password expire never;
3. 刷新 flush privileges;
mysql登陆问题