• Navicat连接mysql8.0:提示无法加载身份验证插件“caching_sha2_password”


    在这里插入图片描述

    Navicat连接mysql时,提示:Unable to load authentication plugin ‘caching_sha2_password‘.

    原因:mysql 8.0 默认使用 caching_sha2_password 身份验证机制。
    在这里插入图片描述

    D:\MySQL8.0\install\bin>mysql -uroot -p123456789   #登录
    mysql: [Warning] Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 22
    Server version: 8.0.32 MySQL Community Server - GPL
    
    Copyright (c) 2000, 2023, Oracle and/or its affiliates.
    
    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> use mysql
    Database changed
    mysql> select user,host,plugin,authentication_string from user;    #查看用户信息
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    在这里插入图片描述

    修改身份验证机制

    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';    #修改身份验证机制
    
    • 1

    更改过程:

    mysql> mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';    #修改身份验证机制
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '4' at line 1
    mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
    Query OK, 0 rows affected (0.07 sec)
    
    mysql> ALTER USER 'pokes'@'%' IDENTIFIED WITH mysql_native_password BY '123456';   #修改身份验证机制 
    Query OK, 0 rows affected (0.06 sec)
    
    mysql>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    MYSQL8.0开启远程链接

    mysql -uroot -p123456
    grant all privileges on *.* to 'root'@'%'identified by 'youpassword' with grant option;  #开启远程访问
    mysql> CREATE USER 'pokes'@'%' IDENTIFIED BY '123456';		#新建一个用户
    mysql> GRANT ALL PRIVILEGES ON *.* TO 'pokes'@'%' WITH GRANT OPTION;   #授权
    mysql> FLUSH PRIVILEGES;    #刷新
    
    • 1
    • 2
    • 3
    • 4
    • 5
    D:\MySQL8.0\install\bin>mysql -uroot -p123456
    mysql: [Warning] Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 19
    Server version: 8.0.32 MySQL Community Server - GPL
    
    Copyright (c) 2000, 2023, Oracle and/or its affiliates.
    
    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> grant all privileges on *.* to 'root'@'%'identified by 'youpassword' with grant option;
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by 'youpassword' with grant option' at line 1
    mysql> CREATE USER 'pokes'@'%' IDENTIFIED BY '123456';
    Query OK, 0 rows affected (0.63 sec)
    
    mysql> GRANT ALL PRIVILEGES ON *.* TO 'pokes'@'%' WITH GRANT OPTION;
    Query OK, 0 rows affected (0.06 sec)
    
    mysql> FLUSH PRIVILEGES;
    Query OK, 0 rows affected (0.08 sec)
    
    mysql>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26

    在这里插入图片描述

  • 相关阅读:
    【前端】爱心代码
    自监督直接和具体任务的结合(Task Related Self-Supervised Learning)的探索
    (待完善)python学习参考手册
    【图解HTTP】|【09】Web的攻击技术
    前端 JS 安全对抗原理与实践
    CocosCreator3.8研究笔记(六)CocosCreator 脚本装饰器的理解
    Nginx Rewrite
    【Deep Dive:AI Webinar】我们是否能将开源许可用于机器学习和人工智能模型?
    1782. 统计点对的数目 双指针
    selenium python 入门教程
  • 原文地址:https://blog.csdn.net/annita2019/article/details/132736944