在idea中链接jdbc遇到的问题

1. java.sql.SQLException: Access denied for user 'root;'@'localhost' (using password: YES)

解决方案

第一个:检查用户名和密码是否不匹配,或者是在连接池里多打了空格之类的(就是配置文件的问题;) 今天的问题就是在properties里多敲了“;”。

.第二个:可能是用户的权限不够,给他添加权限;

授予权限

-- grant all privileges on databasename.tablename to 'user'@'host' identified by 'password';
-- 授予myuser用户全局级全部权限:
GRANT ALL PRIVILEGES ON . TO 'myuser'@'%' IDENTIFIED BY 'mypass' WITH GRANT OPTION;
-- 授予myuser用户针对testdb数据库全部权限:
GRANT ALL PRIVILEGES ON testdb.* TO 'myuser'

3. 编码问题

参考这个https://blog.csdn.net/QQ17680473835/article/details/81841180

4. 数据库和驱动不匹配

附:原文链接:https://blog.csdn.net/qq_41679818/article/details/105857793

posted @ 2022-07-02 10:46  小菜鸡的code之旅  阅读(135)  评论(0编辑  收藏  举报