Solution to the problem of Failed when configuring IDEA to connect to MYSQL database

Solution to the problem of Failed when configuring IDEA to connect to MYSQL database

This article mainly introduces the solution to the problem of Failed when configuring IDEA to connect to MYSQL database, and shares it with you. The details are as follows:

The error location is as follows

We changed it and found that we could connect normally

IDEA failed when trying to connect to MySQL

When I try to connect to Mysql with IDEA, it always shows that the connection failed, and I only know that the connection object cannot be created. Most of the solutions on the Internet are to modify the connection characters, but in the end I found that it was not a problem with the connection string settings. Moreover, this error is easy to encounter for novices like me, so I share it here. = =

Mysql version: Mysql 5.7 Connection jar package: mysql-connector-java-5.1.40-bin.jar

The code is as follows:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class Example11_1 {
 public static void main(String args[]) {
  Connection con = null;
  Statement sql;
  ResultSet rs;
  try {
   Class.forName("com.mysql.jdbc.Driver"); //Load JDBC_MySQL driver} catch (Exception e) {
  }
  String uri = "jdbc:mysql://localhost:3306/jdbc?useSSL=true";
  String user = "root";
  String password = "********";
  try {
   con = DriverManager.getConnection(uri, user, password); //Connection code} catch (Exception e) {
  }
  try {
   sql = con.createStatement();
   rs = sql.executeQuery("SELECT * FROM mess"); //Query the mess table} catch (Exception e) {
   System.out.println(e);
  }finally {
   //con.close();
  }
 }
}

The reason was that the path of the Java project I created contained Chinese characters. Later, I tried to create a new project in the root directory and then connected it. //I'm so stupid.

This is the end of this article about how to solve the problem of Failed when configuring IDEA to connect to MYSQL database. For more relevant content about configuring IDEA to connect to MYSQL, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed explanation of how to connect to MySQL database using Java in IntelliJ IDEA
  • Problems and solutions of error 08001 when linking to MySQL in IDEA and no table display after successful connection
  • JDBC-idea import mysql to connect java jar package (mac)
  • Problems and solutions for IDEA connecting to MySQL
  • IDEA reports an error when connecting to MySQL! Server returns invalid timezone. Go to tab and set serverTimezone property
  • Tutorial on how to connect and use MySQL 8.0 in IDEA's Maven project
  • IDEA uses properties configuration file to connect to MySQL database
  • Detailed diagram of IntelliJ IDEA connecting to MySQL database

<<:  Html easily implements rounded rectangle

>>:  Nginx builds rtmp live server implementation code

Recommend

Detailed steps to install MySQL 8.0.27 in Linux 7.6 binary

Table of contents 1. Environmental Preparation 1....

A practical record of restoring a MySQL Slave library

Description of the situation: Today, I logged int...

MySql fuzzy query json keyword retrieval solution example

Table of contents Preface Option 1: Option 2: Opt...

Detailed explanation of component development of Vue drop-down menu

This article example shares the specific code for...

Summarize the commonly used nth-child selectors

Preface In front-end programming, we often use th...

Nested display implementation of vue router-view

Table of contents 1. Routing Configuration 2. Vue...

Detailed explanation of semiotics in Html/CSS

Based on theories such as Saussure's philosop...

Detailed steps to install Anaconda on Linux (Ubuntu 18.04)

Anaconda is the most popular python data science ...

Linux IO multiplexing epoll network programming

Preface This chapter uses basic Linux functions a...

Java programming to write a JavaScript super practical table plug-in

Table of contents Effects Documentation first ste...

Solution to the problem of invalid width setting for label and span

By default, setting width for label and span is in...

Three examples of nodejs methods to obtain form data

Preface Nodejs is a server-side language. During ...

Centos7 mysql database installation and configuration tutorial

1. System environment The system version after yu...

Navicat for MySQL 15 Registration and Activation Detailed Tutorial

1. Download Navicat for MySQL 15 https://www.navi...