1、由于我安装的是mysql8.0 版本较新,所以刚开始连接时出现了报错:1251- Client does not support authentication protocol requested by server;consider upgrading Mysql client。
根据博客Mysql 解决1251- Client does not support authentication protocol requested by server...的问题_上帝代言人的博客-CSDN博客_1251 client does not support中的如下方法进行修改后,发现报错1045 Access denied for user 'root'@'localhost' (using password: YES)。(这里其实是提示密码错误)
(经历下述一系列修改后,我回头想,为什么只执行了上述语句,就出现了密码错误的报错???现在让我们看看为什么会出现密码错误的1045报错:因为上图中,绿色字体 ‘password’就是修改后的密码!!! 我执行上述语句后,还傻傻的输入原密码123456.)
2、进行密码的修改:
使用如下教程,发现报错 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(“123456”) where user=“root”’ at line 1
1. flush privileges;
2. ALTER USER 'root'@'localhost' IDENTIFIED BY '你要修改的密码';