我用springboot搭了一套框架本地win10系统启动项目访问linux的mysql数据库没问题,可以访问,打包成jar后在linux部署,在访问接口报 "status": 500,
"error": "Internal Server Error",
"message": "Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Access denied for user 'root'@'49.232.89.109' (using password: YES)", 请大神看一下是什么问题?新人第一次来,请见谅
这个bug 跟mysql的密码有关系. 先关闭 mysqld 服务, 在 vim /etc/my.conf
配置文件最下面添加 skip-grant-tables
启动 mysqld 服务,然后直接 mysql -uroot -p (不用密码直接回车就行)
use mysql;
//通过这个查看mysql 密码 authentication_string 就是密码
select host, user, authentication_string, plugin from user;
//设置密码
update user set authentication_string='你的密码' where user='root';
//把之前my.conf 文件中的那行删掉,重启一下mysqld 服务就行