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

Understand CSS3 FlexBox elastic layout in 10 minutes

Basic Introduction Features Flexbox is a CSS disp...

Example to explain the size of MySQL statistics table

Counting the size of each table in each database ...

Example of disabling browser cache configuration in Vue project

When releasing a project, you will often encounte...

CSS3 Tab animation example background switching dynamic effect

CSS 3 animation example - dynamic effect of Tab b...

How to solve the abnormal error ERROR: 2002 in mysql

Recently, an error occurred while starting MySQL....

Use pictures to realize personalized underline of hyperlinks

Don't be surprised if you see some kind of und...

HTML Tutorial: Definition List

<br />Original text: http://andymao.com/andy...

Detailed explanation of the four transaction isolation levels in MySQL

The test environment of this experiment: Windows ...

WeChat applet implements sorting function based on date and time

I recently took over a small program project, and...

Abbreviation of HTML DOCTYPE

If your DOCTYPE is as follows: Copy code The code ...

Explanation of MySQL index types Normal, Unique and Full Text

MySQL's index types include normal index, uni...

Linux common commands chmod to modify file permissions 777 and 754

The following command is often used: chmod 777 文件...

Working principle and implementation method of Vue instruction

Introduction to Vue The current era of big front-...