一、修改密码
1:启动mysql服务
java systemctl start mysqld.service //启动 systemctl status mysqld.service //查看状态
2:进入mysql并修改密码
grep 'temporary password' /var/log/mysqld.log //查看临时密码mysql -uroot -p //进入mysql命令行
ALTER USER 'root'@'localhost' IDENTIFIED BY '你自己要改的新密码'; //修改密码
mysql报错:
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
3:修改密码设置策略
use mysql; //使用自带的mysql数据库SHOW VARIABLES LIKE 'validate_password%'; //查看密码策略
set global validate_password.policy=0; //默认等级为MEDIUM(中等)改为lowset global validate_password.length=5; //只验证长度5ALTER USER 'root'@'localhost' IDENTIFIED BY '你自己要改的新密码'; //再改
二、SQLyog连接mysql服务
1:查看ip及mysql端口
ifconfig //查看虚拟机ipmysql -uroot -p新密码 //切换到mysql命令,-p后跟新设置的密码show global variables like 'port'; //查看端口
2:SQLyog连接时错误码
SQLyog连接输入ip、新密码
错误码是防火墙问题,可以关闭防火墙:
systemctl status/start/stop firewalld //查看/开启/关闭 防火墙systemctl disable firewalld //禁止开机启动
3:1130错误码
权限问题:
mysql>use mysql;mysql>update user set host = '%' where user ='root';mysql>flush privileges;
4:2058错误码
密码加密问题,修改加密规则为不加密:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';
mysql报错:
ERROR 1396 (HY000): Operation ALTER USER failed for ‘root’@‘localhost’
改成:
ALTER USER 'root' IDENTIFIED WITH mysql_native_password BY '你的密码';
5:再次连接成功
如果觉得《SQLyog连接虚拟机中mysql8.0详解 1130 2058错误码解决》对你有帮助,请点赞、收藏,并留下你的观点哦!