bug解决:Access denied for user ‘root‘@‘localhost‘ (using passwordYES)

bug解决:Access denied for user ‘root’@‘localhost’ (using password:YES)

都是说密码错误了,改了密码就好了。然而这种情况并不适合本人遇到的情况,cmd已经登录上去,我确定密码是正确的,但为了解决问题还是把网上说的各种方法都尝试了一遍。

如:cmd命令行:

use mysql grant all privileges on . to ‘root’@‘localhost’ identifies by ‘新设置的密码’;

use mysql

update user set authentication_string=password(‘新设置的密码’) where user = ‘root’; (修改密码的步骤)

flush privileges;

quit

或者

在mysql的bin目录下的my.ini文件中添加skip-grant-tables,即cmd命令时不输入密码,直接按回车键。

但还是出现这个问题,本人的问题仍然没有解决。

我的问题是在Spark与JDBC连接时产生的,在我要将数据保存在mysql上的时候报的错误

最终解决方案:

步骤1: 【Windows+R】打开命令提示符,输入netstat -ano 会显示所有已经在运行的端口。

步骤2: 输入你想要查找的正在占用的端口号,如:netstat -ano|findstr 3306

步骤3: 此时会显示端口3306对应的TCP号

步骤4:在任务管理器的服务中"详细信息"中找到对应的端口TCP号将其结束

但又会出现mysql连接不上的错误

bug解决:Access denied for user ‘root‘@‘localhost‘ (using passwordYES)

–但别怕 往下看

bug解决:Access denied for user ‘root‘@‘localhost‘ (using passwordYES)

在服务中将其重启bug解决:Access denied for user ‘root‘@‘localhost‘ (using passwordYES)

然后再重新启动Navicat就好了,也可以保存数据到mysql中了