java - SQLException : Access denied for user 'utilisateur1'@'localhost' (using password: YES)
问题描述
package com.exmaven2;
import java.sql.*;
public class MainApp
{
public static void main(String[] args)
{
String url = "jdbc:mysql://localhost:3306/baseune";
String userName = "utilisateur1";
String password = "password";
try {
java.sql.Connection con = DriverManager.getConnection(url, userName, password);
} catch (SQLException e) {
e.printStackTrace();
}
}
}
Hello, I'm actually trying to connect to MySQL with a Maven project build in Eclipse IDE. I wrote this code that should let me connect to my server but I'm getting the error described in the title. I just began learning about databases and MySQL so I don't really know what to do. I already checked the privileges for 'utilisateur1' (somebody else posted the same question but this answer didn't work for me) and i have them all so I don't understand why it doesn't work.
解决方案
你能试试这个吗
package com.exmaven2;
import java.sql.*;
public class MainApp
{
public static void main(String[] args)
{
String url = "jdbc:mysql://localhost:3306/baseune?useSSL=false";
String userName = "utilisateur1";
String password = "password";
try {
Connection con = DriverManager.getConnection(url, userName, password);
} catch (SQLException e) {
e.printStackTrace();
}
}
}
推荐阅读
- jenkins - 在 Jenkins 管道中运行时出现 sfdx 错误
- angular - 角度 6 中的搜索过滤器
- c - 关于函数声明中省略return语句的问题
- excel - 根据我们可能所在的前一个月过滤12个月前的数据,而无需手动输入开始和结束日期?
- c# - 为什么我的服务器无法响应来自网络浏览器的客户端请求?
- r - 如何在ggplot2的文本中下标字母或数字
- java - 如何使用 selenium 检查警报的可见性
- reactjs - 无法在反应js中获取道具中的数据
- web-services - 如何从外部监听客户端对 ASMX Web 服务服务器的调用?
- mongodb - 带有添加字段的 Mongolite 聚合查询