mysql因版本問題造成報錯的處理
阿新 • • 發佈:2021-12-14
8.0.##版本的mysql使用低版本的MySql.Data.dll,連線資料庫時會報錯:Authentication method 'caching_sha2_password' not supported by any of the available plugins.
解決方式:(兩種),第一種需要重啟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 inMySQL. 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
然後重啟mysql服務:
net stop mysql
net start mysql
第二種
更換高版本的MySql.Data.dll檔案
地址:https://files.cnblogs.com/files/blogs/667310/MySql.Data.rar
不需要重啟mysql服務