springboot开发的时候,我用反向生成代码没问题,程序启动因为没问题,我的数据库肯定是授权任何人访问了的但是浏览器访问的时候报错没有权限访问我的数据库,这是为什么??
可以把浏览器访问后的开发工具控制台输出的错误信息贴出来,这样便于对问题的分析。
你也可以检查一下项目环境,是否添加了相关依赖,jdbc驱动,是否在.yml文件中配置了数据库连接信息,连接信息是否有误等;
ERROR 10052 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[.[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [/12-springboot-mybatis] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user ''@'192.168.1.190' (using password: YES)
老师,报错信息是这样的:ERROR 10052 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[.[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [/12-springboot-mybatis] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user ''@'192.168.1.190' (using password: YES)