mysql 驱动 保存密码_连接mysql时出现问题。找不到合适的驱动程序,用户''@'localhost'的访问被拒绝(使用密码:是)...

MySQL8.0.15版本

MySQL-connector-java-8.0.15接口

import javafx.application.Application;

import javafx.fxml.FXMLLoader;

import javafx.scene.Scene;

import javafx.scene.layout.AnchorPane;

import javafx.stage.Stage;

import java.sql.*;

public class Main extends Application {

public static void main(String[] args) throws Exception {

Statement statement = null;

Connection connection = null;

ResultSet resultSet = null;

try {

connection =

DriverManager.getConnection("jdbc:mysql://localhost/firma?" +

"user=root&password=database123");

} catch (SQLException ex) {

// handle any errors

System.out.println("SQLException: " + ex.getMessage());

System.out.println("SQLState: " + ex.getSQLState());

System.out.println("VendorError: " + ex.getErrorCode());

}

launch(args);

}

SQLException:找不到适合jdbc的驱动程序:mysql://localhost/firma?用户=根密码=数据库123

州:08001

供应商错误:0

SQLException:服务器时区值“rodkowoeuropejski czas stand”无法识别或表示多个时区。如果要利用时区支持,则必须配置服务器或JDBC驱动程序(通过serverTimezone配置属性)以使用更具体的时区值。

SQL状态:01S00

供应商错误:0

DriverManager.getConnection("jdbc:mysql://localhost/firma?useLegacyDatetimeCode=false&serverTimezone=UTC?" +

"user=root&password=database123");

最后我得到:

SQLException:拒绝用户“@”localhost的访问(使用密码:是)

州:28000

为什么他不在这里显示用户名?

数据库存在,url中的用户和密码正确。

+------------------+-----------+

| user | host |

+------------------+-----------+

| mysql.infoschema | localhost |

| mysql.session | localhost |

| mysql.sys | localhost |

| root | localhost |

+------------------+-----------+

从控制台我可以登录到mysql没有任何问题。

求你了,帮帮我。我的手已经掉下来了。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值