解决办法:

1. SELECT * FROM mysql.user WHERE USER='root';

2. GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.107.61' IDENTIFIED BY 'root';

3. FLUSH PRIVILEGES;

解决后的截图: 

Caused by: java.sql.SQLException: Access denied for user 'root'@'host' (using password: YES)

错误的具体现象: 
1,开发同学都可以在自己电脑上连接测试服务器上的数据库 
2,在服务器上通过命令mysql -uroot -proot可以连上数据库,但是通过mysql -uroot -proot -h192.168.107.61(服务器ip)连不上 
3,程序sql日志,查询可以正常输出,更新就会报超时,然后报这个错误。

执行完解决办法的sql后,问题解决。不需要重新mysql和tomcat服务。 

实在没理解为什么查询可以打印查询结果,更新报错。重新授权后,更新就可以了。同样的数据,同样的代码。


转载自>https://blog.csdn.net/zl544434558/article/details/54317696

相关文章:

  • 2021-10-03
  • 2022-02-19
  • 2021-12-05
  • 2021-09-14
  • 2021-07-22
  • 2021-07-31
猜你喜欢
  • 2021-08-13
  • 2021-05-06
  • 2021-08-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-14
相关资源
相似解决方案