This article shares a collection of Java problems that cannot connect to MySQL 8.0 for your reference. The specific content is as follows Question 1: Client does not support authentication protocol requested by Server;… Question 2: Unknown initial character set index '255' received from server… Question 3: MySQL 8.0 connection necessary URL statement Problem 4: Duplicate method calls Run Question 1 : Solution: (note the semicolon in the 3 sentences, Question 2: Solution: (delete duplicate packages) The import is also deleted, leaving only the correct one: Then Key: MySQL 8.0 needs to add this sentence : ?useSSL=false&serverTimezone=UTC public static String dbUrl="jdbc:mysql://localhost:3306/websql?useSSL=false&serverTimezone=UTC"; Running results: Question 4: Solution: (The second connection name must be different) Running results: Attach the connection DbUtil class: package com.cungudafa; import java.sql.Connection; import java.sql.DriverManager; public class DbUtil { public static String dbUrl="jdbc:mysql://localhost:3306/websql?useSSL=false&serverTimezone=UTC"; public static String dbUserName="root"; public static String dbPassword="wy123456"; public static String jdbcName="com.mysql.jdbc.Driver"; public static Connection getCon() throws Exception { Class.forName(jdbcName); Connection con=DriverManager.getConnection(dbUrl,dbUserName,dbPassword); return con; } public static void closeCon(Connection con) { try { if (con != null) { con.close(); } } catch (Exception e) { e.printStackTrace(); } } } The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: How to expand the disk partition for centos system
>>: vue_drf implements SMS verification code
Table of contents 1. Filter unique values 2. Shor...
Friends always ask me how to hide Linux processes...
Table of contents 1. How to obtain different view...
Enable WSL Make sure the system is Windows 10 200...
Table of contents Preface Input box component lay...
Table of contents Styles in uni-app Summarize Sty...
Questions about select elements in HTML have been...
Table of contents Preface What does yarn create d...
How to declare a cursor in mysql: 1. Declare vari...
Preface Basically, programmers in the workplace u...
1: I won’t go into the details of how to install ...
Table of contents 1. Installation requirements 2....
This article shares the specific code of js to re...
Table of contents background How to determine whe...
1. Overview of file permissions and ownership 1. ...