当前位置: 首页 > news >正文

MySql.Data.dll 因版本问题造成报错的处理

NetCore 链接MySQL 报 Character set ‘utf8mb3‘ is not supported by .Net Framework 异常解决_character set utf8mb3_csdn_aspnet的博客-CSDN博客

查看mysql版本号,两种办法:

第一种在数据库中执行查询:SELECT @@version;

第二种使用工具 Navicat:

点击连接节点:

 

在右侧会显示mysql版本:

使用8.0.1x的MySql.Data.dll连接mysql8.0.xx版本mysql数据库,连接数据库时会报错:Authentication method 'caching_sha2_password' not supported by any of the available plugins. 

印象中(具体版本记不清了)MySQL数据库版本大于8.0.26使用8.0.1x的MySql.Data.dll就会报上面的异常信息,MySql.Data.dll版本信息如下:

解决方式:(两种),第一种需要重启mysql服务,第二种不需要重启服务

第一种:

mysql文件中增加my.ini文件,内容如下,关键时最后一行:default_authentication_plugin=mysql_native_password

然后修改mysql的配置文件路径:

打开cmd,进入命令行,输入:mysqld --defaults-file="D:\soft\mysql-8.0.23-winx64\my.ini"

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_bin
init_connect='SET NAMES utf8mb4'
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = D:\\soft\mysql-8.0.23-winx64
datadir = D:\\soft\mysql-8.0.23-winx64\data
port = 3306
# server_id = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
join_buffer_size = 128M
sort_buffer_size = 16M
read_rnd_buffer_size = 16M 
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
default_authentication_plugin=mysql_native_password

其实相当于降低数据库版本,本机安装了mysql8.0.32版本设置了default_authentication_plugin:

 

然后重启mysql服务:

net stop mysql

net start mysql

但是重启之后还是不能连接:

第二种

更换高版本的MySql.Data.dll文件,由于项目时nuget安装包,所以再项目发布后,将MySql.Data.dll替换为高版本程序可正常运行,其实是将发布后的8.0.15版本的MySql.Data.dll替换为8.0.29版本的MySql.Data.dll,如下:

 替换后访问程序均正常,后续可能将使用MySqlConnector.dll,尽量避免此问题。

 

 

 

http://www.lryc.cn/news/68903.html

相关文章:

  • 囚徒困境——从博弈论的角度解释“美女配丑男”
  • 运算符重载函数作为类的成员函数——有理数的约分
  • mysql数据库的内置函数--7
  • DS3800HPIB 有效执行任务的所有程序
  • 图像比对、人像比对和人脸识别的区别是什么?
  • python中的抽象基类
  • 耗时几个月,终于决定把原本想用于商业的系统开源了
  • HarmonyOS应用端云一体化开发主要流程
  • NoSQL之 Redis配置与优化
  • Redis哨兵模式
  • 数据库管理-第七十六期 如何升级19c RAC(20230516)
  • 组合预测模型 | ARIMA-CNN-LSTM时间序列预测(Python)
  • 实验四 面向对象分析与设计——UML类图与时序图
  • 最短路径问题
  • 国内有哪些SAAS软件?SAAS软件有哪些优点?
  • 分享两组不同的3D VR卡片
  • 外贸人如何精准开发客户?Facebook开发客户全攻略
  • 一、Git安装(Git+TortoiseGit图形化)
  • mysql死锁,如何产生?如何发现?如何处理?
  • YOLO V1-V3 简单介绍
  • 数据结构总结1:了解数据结构、时间复杂度、空间复杂度
  • abstract class和interface有什么区别?
  • Kafka在Java项目中的应用
  • 理解分布式id生成算法SnowFlake
  • 光纤收发器可以连接光模块吗?
  • 一文快速了解浏览器Sui Explorer
  • python中lambda、yield、map、filter、reduce的使用
  • 第十八章 使用LNMP架构部署动态网站环境
  • 无人值守的IDC机房动环综合运维方案
  • 桌面远程工具推荐