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

Should I use Bootstrap or jQuery Mobile for mobile web wap

Solving the problem Bootstrap is a CSS framework ...

Rounding operation of datetime field in MySQL

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

Example of how to build a Mysql cluster with docker

Docker basic instructions: Update Packages yum -y...

How to use http and WebSocket in CocosCreator

Table of contents 1. HttpGET 2. HTTP POST WebSock...

Use simple jQuery + CSS to create a custom a tag title tooltip

Introduction Use simple jQuery+CSS to create a cus...

Web Design Tutorial (3): Design Steps and Thinking

<br />Previous tutorial: Web Design Tutorial...

Use Docker to run multiple PHP versions on the server

PHP7 has been out for quite some time, and it is ...

In-depth explanation of MySQL isolation level and locking mechanism

Table of contents Brief description: 1. Four char...

Basic operation tutorial of files and permissions in centos

Preface Before we begin, we should briefly unders...

Detailed examples of Linux disk device and LVM management commands

Preface In the Linux operating system, device fil...

HTML thead tag definition and usage detailed introduction

Copy code The code is as follows: <thead> &...