关于使用docker-compose部署nacos与mysql8.0之后nacos连接不上mysql的问题

2023-05-16

项目场景:

使用docker-compose来对安装部署的docker进行统一管理。


问题描述

在使用docker-compose restart命令一键启动时,nacos在连接mysql8.0的时候出现了问题,再考虑到有可能是mysql版本之后更改为mysql5.7版本连接没出现问题。

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'asyncNotifyService': Unsatisfied dependency expressed through field 'dumpService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'externalDumpService': Invocation of init method failed; nested exception is ErrCode:500, ErrMsg:Nacos Server did not start because dumpservice bean construction failure :
No DataSource set
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:598)
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:376)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1402)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:591)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1196)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:857)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:760)
        ... 27 common frames omitted

原因分析:

在重新给其他服务器部署运行环境时,了解到mysql8.0与mysql5.7的密码认证插件不一样,mysql5.7使用的是mysql_native_password ,而mysql8.0使用的是caching_sha2_password 。


解决方案:

将mysql8.0的默认认证插件caching_sha2_password 更改为mysql_native_password 。

一、安装部署mysql8.0
二、在my.cnf中加入authentication_policy= mysql_native_password

# Custom config should go here
!includedir /etc/mysql/conf.d/

authentication_policy= mysql_native_password

三、更改之前用户使用的认证插件

mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';

四、查看用户认证插件

mysql> select host,user,plugin from user;
+-----------+------------------+-----------------------+
| host      | user             | plugin                |
+-----------+------------------+-----------------------+
| %         | root             | mysql_native_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
| localhost | root             | caching_sha2_password |
+-----------+------------------+-----------------------+
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

关于使用docker-compose部署nacos与mysql8.0之后nacos连接不上mysql的问题 的相关文章

  • Linux:服务器相关指令

    服务相关命令 1 随着微服务兴起 xff0c springboot也用得越来越多 xff0c springboot项目默认是打包成jar包的 xff0c 执行jar包就可以同时启动其内置的tomcat xff0c 免去了单独部署tomcat
  • Linux:用户相关

    Linux用户 1 Linux系统是一个多用户多任务的分时操作系统 xff0c 任何一个要使用系统资源的用户 xff0c 都必须首先向系统管理员申请一个账号 xff0c 然后以这个账号的身份进入系统 2 用户的账号一方面可以帮助系统管理员对
  • Selenium:简介

    HTML简介 1 HTML中文为超文本标记语言 HyperText Markup Language 是一种用于创建网页的标准标记语言 2 HTML是用来描述网页的一种语言 nbsp nbsp nbsp HTML不是一种编程语言 而是一种标记
  • Selenium:元素定位

    Selenium自动化测试 1 Selenium对网页的控制是基于各种前端元素的 在使用过程中 对于元素的定位是基础 只有准确抓取到对应元素才能进行后续的自动化控制 nbsp nbsp nbsp 前面介绍了前端网页HTML是由很多标签元素有
  • Selenium:浏览器操作

    Selenium浏览器操作 1 前面介绍过 根据Selenium下的WebDriver类可以实例化一个浏览器WebDriver对象 返回WebDriver对象 2 打开一个指定网页 定位HTML文档中指定元素都是根据浏览器WebDriver
  • Selenium:弹窗处理

    HTML中的弹窗 1 在实际系统中 在完成某些操作时会弹出对话框来提示 主要分为 警告消息框 确认消息框 提示消息对话 三种类型的对话框 2 警告消息框 alert 警告消息框提供了一个 确定 按钮让用户关闭该消息框 并且该消息框是模式对话
  • Selenium:表单切换

    表单 1 就是网页标签名为frame或iframe的元素 表单引用了其他页面的链接 真正的页面数据没有出现在源码中 但是在浏览器中可以看见 与浏览器的多个窗口类似 nbsp nbsp nbsp 这里说的表单不是HTML中的form标签 而是
  • Seleniu:元素常用操作

    Selenium元素操作 1 在使用Selenium过程中 仅仅是对元素进行定位和对浏览器WebDriver对象进行操作是完全不够的 更多的是需要我们对一个元素进行操作 nbsp nbsp nbsp 比如 向输入框中输入数据 点击按钮等等
  • Selenium:鼠标、键盘事件

    鼠标事件 1 前面介绍了Selenium中模拟鼠标 左键单击 的方法click 仅仅只有这个方法是完全不够的 现在的Web产品中提供了更丰富的鼠标交互方式 nbsp nbsp nbsp 例如鼠标右击 双击 悬停 拖动等功能 nbsp nbs
  • rust实现一个tcp server

    服务端 use std net TcpListener TcpStream use std thread use std time use std io use std io Read Write fn handle client mut
  • Selenium:元素判断

    判断元素是否存在 1 前面有介绍过使用Python中的sleep 方法来进行等待 等待一定的时间 让元素加载出来后再执行代码 nbsp nbsp nbsp 但是元素加载出来的时间是不固定的 有时长有时短 因此我们等待的时间就不固定了 nbs
  • Selenium:元素等待

    元素等待 1 前面介绍过 在使用Selenium做Web自动化过程中 可能会因为网络等原因导致页面元素没有加载出来就执行了代码 进而导致报错 nbsp nbsp nbsp 特别是在进行元素定位时 经常会遇到元素未加载出来就执行了定位代码 导
  • Selenium:操作Cookie

    什么是Cookie 1 Cookie用于辨别用户身份 访问服务器时保持登录状态等功能 用于服务器识别当前访问的是哪个用户 2 在网站中 http请求是无状态的 无状态是指协议对于事务处理没有记忆能力 每次请求都是完全独立 互不影响的 没有任
  • Selenium:操作JS

    JavaScript 1 JavaScript是Web的编程语言 所有现代的HTML页面都会使用JavaScript nbsp nbsp nbsp JavaScript是运行在客户端 浏览器 和服务器端的脚本语言 允许将静态网页转换为交互式
  • Selenium:下拉框操作

    下拉框 1 在Web网页中经常会遇到下拉框 下拉列表 比如说分页 每页显示的条数 语言的切换等功能 很多时候经常都是以下拉框的形式展现 2 下拉列表是网页中一种最节省页面空间的选择方式 默认状态下只显示一个选项 只有单击下拉按钮后才能看到全
  • Selenium:上传、下载文件

    Selenium 上传 下载文件 1 上传文件是比较常见的Web功能之一 比如 常见的上传头像功能 2 对于Web页面的上传功能实现一般有以下两种方式 nbsp nbsp nbsp 普通上传 普通的附件上传是将本地文件的路径作为作为一个值放
  • Python:类的__dict__属性

    Python中类的 dict 属性 1 Python中一切皆对象 nbsp nbsp nbsp 不管是内置的数据类型 内置函数 内置类 第三方类 还是自定义类都叫做对象 nbsp nbsp nbsp 一个对象就会有自己的方法或属性 只是说有
  • Python:处理XML文件汇总

    处理XML文件汇总 1 前面介绍了使用Python中的ElementTree库来解析 创建XML文件 nbsp nbsp nbsp 如果对这个库不了解的可以先去看看这个库 nbsp nbsp nbsp 地址 https mouse blog
  • Python:json数据与Python对象之间的转换

    json数据与Python对象之间的转换 1 前面介绍了在Python中如何处理json数据 主要使用了以下几个方法 nbsp nbsp nbsp dumps 将Python对象转换为JSON格式的字符串 nbsp nbsp nbsp du
  • 用结构体指针访问结构体中的结构体指针(结构体指针的嵌套)

    结构体中的结构体指针是使用 一 问题背景二 代码三 说明 一 问题背景 日常工作中没有编程的机会 xff0c 所以只看得懂代码 xff0c 现在需要重新写一段代码 xff0c 实现固定格式存储数据 xff0c 需要使用到结构体和结构体指针

随机推荐