一、部署完xxljob访问页面报错
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Access denied for user 'admin'@'192.168.21.21' (using password: YES)
### The error may exist in class path resource [mybatis-mapper/XxlJobUserMapper.xml]
### The error may involve com.xxl.job.admin.dao.XxlJobUserDao.loadByUserName
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Access denied for user 'admin'@'192.168.21.21' (using password: YES)
二、解决
1、删除镜像容器,重新创建
## 删除镜像
docker stop 镜像id
docker rm 镜像id
重新创建容器,注意观察好数据库名称,密码,以及应用设置的名称。
2、进行权限设置
1、开启数据库远程访问权限设置,
2、仍然报错的话,新添加个数据库连接用户,更新密码,开启访问权限再试下
# 创建特权管理用户
grant all on job.* to xxl_job@'%' identified by '123456' with grant option;
## mysql 用户授权数据库(xxl_job:docker的数据库名;xxljob2023:docker的数据库密码)
## 设置select和update权限
grant select on *.* to 'xxl_job'@'%' identified by 'xxljob2023';
grant update on *.* to 'xxl_job'@'%' identified by 'xxljob2023';
# 查看用户创建是否成功
select user,host from mysql.user;
# 查看用户权限
show grants for job;
// 刷新修改后的系统表
FLUSH PRIVILEGES;