MySQL,8:連接錯(cuò)誤信息對(duì)應(yīng)x

        發(fā)布時(shí)間:2020-10-05 來(lái)源: 精準(zhǔn)扶貧 點(diǎn)擊:

         MySQL 8 :連接錯(cuò)誤信息對(duì)應(yīng) 這篇文章記錄一下在 MacOS 的 Catalina 版本下使用 MacOS 下安裝的 MySQL 8 在進(jìn)行客戶(hù)端連接時(shí)所碰到的問(wèn)題。

         環(huán)境說(shuō)明 • 操作系統(tǒng)版本: 10.15.2 liumiaocn:target liumiao$ sw_vers

         ProductName:

         Mac OS X

         ProductVersion: 10.15.2

         BuildVersion:

          19C57

         liumiaocn:target liumiao$

         • MySQL 版本: 8.0.11 liumiaocn:target liumiao$ mysql -uroot -p

         Enter password:

         Welcome to the MySQL monitor.

         Commands end with ; or \g.

         Your MySQL connection id is 46

         Server version: 8.0.11 Homebrew

          Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

          Oracle is a registered trademark of Oracle Corporation and/or its

         affiliates. Other names may be trademarks of their respective

         owners.

          Type "help;" or "\h" for help. Type "\c" to clear the current input statement.

          mysql>

         • MySQL 運(yùn)行狀態(tài) liumiaocn:target liumiao$ mysql.server status

          SUCCESS! MySQL running (4633)

         liumiaocn:target liumiao$

         問(wèn)題現(xiàn)象 使用 MySQL Workbench 的如下配置

         點(diǎn)擊 Test Connection 時(shí),提示如下錯(cuò)誤信息

         原因 MySQL 8 中的認(rèn)證方式發(fā)生了變化

         使用如下 SQL 即可確認(rèn)當(dāng)前 root 用戶(hù)的認(rèn)證方式:

         mysql> SELECT Host, User, plugin from mysql.user;

         +-----------+------------------+-----------------------+

         | Host

         | User

          | plugin

         |

         +-----------+------------------+-----------------------+

         | localhost | mysql.infoschema | mysql_native_password |

         | localhost | mysql.session

         | mysql_native_password |

         | localhost | mysql.sys

         | mysql_native_password |

         | localhost | root

          | caching_sha2_password |

         +-----------+------------------+-----------------------+

         4 rows in set (0.00 sec)

          mysql>

         對(duì)應(yīng)方法 最簡(jiǎn)單的方式莫過(guò)于直接修改,比如使用如下 SQL 即可 mysql> ALTER USER "root"@"localhost" IDENTIFIED WITH mysql_native_password BY "liumiao123";

         Query OK, 0 rows affected (0.03 sec)

          mysql>

         確認(rèn)完之后再次確認(rèn)結(jié)果 mysql> SELECT Host, User, plugin from mysql.user;

         +-----------+------------------+-----------------------+

         | Host

         | User

          | plugin

         |

         +-----------+------------------+-----------------------+

         | localhost | mysql.infoschema | mysql_native_password |

         | localhost | mysql.session

         | mysql_native_password |

         | localhost | mysql.sys

         | mysql_native_password |

         | localhost | root

          | mysql_native_password |

         +-----------+------------------+-----------------------+

         4 rows in set (0.00 sec)

          mysql>

         當(dāng)然,直接修改 MySQL 的配置文件,然后重新啟動(dòng)也可以設(shè)定成功,而且設(shè)定會(huì)持久保存。

         [mysqld]

         default_authentication_plugin=mysql_native_password

         結(jié)果確認(rèn) 此時(shí)使用 MySQL Workbench 再次連接,Test Connection 即可正常動(dòng)作了。

         正確輸入上述修改的密碼之后,即可顯示連接成功了。

        相關(guān)熱詞搜索:錯(cuò)誤信息 連接 MySQL

        版權(quán)所有 蒲公英文摘 www.zuancaijixie.com
        91啦在线播放,特级一级全黄毛片免费,国产中文一区,亚洲国产一成人久久精品