Solution to nacos not being able to connect to mysql

Solution to nacos not being able to connect to mysql

reason

The mysql version that nacos's pom depends on is inconsistent with the mysql version.

Step 1:

Modify the mysql version dependency in the pom file

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

Step 2:

Building project solves compilation errors (delete old dependencies)

insert image description here

Step 3:

Repackage mvn -Prelease-nacos -Dmaven.test.skip=true clean install -U

Add mysql configuration location

insert image description here

Solve the problem that Nacos cannot connect to Mysql8.0+

Nacos 0.7 version added support for MySQL data source function, and the configuration of the Nacos cluster can be persisted to MySQL.
However, when I used mysql8.0.19, an exception occurred when connecting with nacos.

insert image description here

If the system prompts that the database cannot be connected, check the configured database connection to make sure it is correct.

spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://localhost:3306/nacos_config?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
db.user=root
db.password=123456

Solution:

Create a new plugins/mysql folder in the nacos installation directory, put the 8.0+ version of mysql-connector-java-8.0.xx.jar in it, and restart nacos.
When starting, it will prompt that the driver-class of mysql has been changed.

insert image description here

This is the end of this article about the solution to the problem that nacos cannot connect to mysql. For more related content about nacos cannot connect to mysql, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to configure MySQL8 in Nacos

<<:  Zabbix combined with bat script to achieve multiple application status monitoring method

>>:  CSS flex several multi-column layout

Recommend

Detailed analysis and usage of tcpdump command under Linux

Introduction To put it simply, tcpdump is a packe...

js to implement collision detection

This article example shares the specific code of ...

Nginx server adds Systemd custom service process analysis

1. Take nginx as an example Nginx installed using...

Implementation of HTML to PDF screenshot saving function

Using Technology itext.jar: Convert byte file inp...

Analysis of examples of using anti-shake and throttling in Vue components

Be careful when listening for events that are tri...

How to create a table by month in MySQL stored procedure

Without going into details, let's go straight...

Implementation of mysql configuration SSL certificate login

Table of contents Preface 1. MySQL enables SSL co...

Vue implements small form validation function

This article example shares the specific code of ...

Explanation and example usage of 4 custom instructions in Vue

Four practical vue custom instructions 1. v-drag ...

Image hover toggle button implemented with CSS3

Result:Implementation Code html <ul class=&quo...

Detailed explanation of the use cases of Vue listeners

The first one is to use jQuery's ajax to send...

Rounding operation of datetime field in MySQL

Table of contents Preface 1. Background 2. Simula...

Solution to the problem of not finding Tomcat configuration in Intelli Idea

I joined a new company these two days. The compan...

Detailed tutorial on installing the jenkins container in a docker environment

Recommended Docker learning materials: https://ww...