About the configuration problem of MyBatis connecting to MySql8.0 version

About the configuration problem of MyBatis connecting to MySql8.0 version

When learning mybatis, I encountered an error, the error is as follows:

Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Cause:

  • The local database version is MySQL 8.0
  • Import the MySQL jar package version in the pom.xml configuration file as

insert image description here

The error is caused by the inconsistency between the local database version and the jar package version imported into MySQL

Solution:

[1] Install the corresponding version of the database locally. Since I have MySQL 5.6 and MySQL 8.0 installed locally, switching the database to MySQL 5.6 solves the problem.
[2] Modify the pom.xml configuration file, no need to switch the database

<dependency>
   <groupId>mysql</groupId>
   <artifactId>mysql-connector-java</artifactId>
   <version>8.0.18</version>
</dependency>

Supplement: Mybatis connection to mysql8.0 is abnormal

The reference to entity "serverTimezone" must end with the ';' delimiter.

Reference to entity 'serverTimeZone' must end with a ';' delimiter.
The solution is to use & instead in the xml configuration file.
Right now

<property name="jdbcUrl"> jdbc:mysql://localhost:3306/exam?characterEncoding=utf8&amp;serverTimezone=UTC </property>

This is the end of this article about the configuration issues of MyBatis connecting to MySql8.0 version. For more relevant MyBatis connecting to MySql8.0 content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • MySQL 8.0.24 version installation and configuration method graphic tutorial
  • Some improvements in MySQL 8.0.24 Release Note
  • Implementation of MySQL's MVCC multi-version concurrency control
  • The best solution for resetting the root password of MySQL 8.0.23
  • How to solve the problem that Seata cannot use MySQL 8 version
  • Detailed explanation of DBeaver connecting to MySQL version 8 and above and solving possible problems
  • Bugs encountered when using mybatis-generator with mysql8.0.3 in IDEA
  • Solution to the garbled code problem in MySQL 5.x
  • Detailed tutorial on installing MySQL 8.0.20 database on CentOS 7
  • Solution to ONLY_FULL_GROUP_BY error in Mysql5.7 and above
  • Solve the installation problem of mysql8.0.19 winx64 version
  • Django 2.2 and PyMySQL version compatibility issues
  • Steps to install MySQL 5.7 in binary mode and optimize the system under Linux
  • Installation of various versions of MySQL 8.0.18 and problems encountered during installation (essence summary)
  • Super detailed teaching on how to upgrade the version of MySQL

<<:  Learn the common methods and techniques in JS arrays and become a master

>>:  XHTML 1.0 Reference

Recommend

Detailed explanation of HTML's <input> tag and how to disable it

Definition and Usage The <input> tag is use...

Summary of Mysql slow query operations

Mysql slow query explanation The MySQL slow query...

How to install babel using npm in vscode

Preface The previous article introduced the insta...

How to configure jdk environment under Linux

1. Go to the official website to download the jdk...

Realize breadcrumb function based on vue-router's matched

This article mainly introduces the breadcrumb fun...

In-depth explanation of special permissions SUID, SGID and SBIT in Linux

Preface For the permissions of files or directori...

Vue + OpenLayers Quick Start Tutorial

Openlayers is a modular, high-performance and fea...

50 Super Handy Tools for Web Designers

Being a web designer is not easy. Not only do you...

Learn the operating mechanism of jsBridge in one article

Table of contents js calling method Android 1.js ...

Docker image management common operation code examples

Mirroring is also one of the core components of D...

How to achieve 3D dynamic text effect with three.js

Preface Hello everyone, this is the CSS wizard - ...

Problems and solutions of using jsx syntax in React-vscode

Problem Description After installing the plugin E...

How to implement scheduled backup of MySQL in Linux

In actual projects, the database needs to be back...

Detailed tutorial on installing nvidia driver + CUDA + cuDNN in Ubuntu 16.04

Preparation 1. Check whether the GPU supports CUD...

vue3 timestamp conversion (without using filters)

When vue2 converts timestamps, it generally uses ...