Authentication plugin 'caching_sha2_password' cannot be loaded

前端 未结 30 2824
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 05:19

I am connecting MySQL - 8.0 with MySQL Workbench and getting the below error:

Authentication plugin \'caching_sha2_password\' cannot be loaded: dlop

相关标签:
30条回答
  • 2020-11-22 05:47

    For those using Docker or Docker Compose, I experienced this error because I didn't set my MySQL image version. Docker will automatically attempt to get the latest version which is 8.

    I set MySQL to 5.7 and rebuilt the image and it worked as normal:

    version: '2'
    services: 
      db:
       image: mysql:5.7
    
    0 讨论(0)
  • 2020-11-22 05:49

    Try using legacy password while downloading and installing MySql, that helped me. Or follow the method posted by Santhosh Shivan for Mac OS.

    0 讨论(0)
  • 2020-11-22 05:50

    Here is the solution which worked for me after MySQL 8.0 Installation on Windows 10.

    Suppose MySQL username is root and password is admin

    Open command prompt and enter the following commands:

    cd C:\Program Files\MySQL\MySQL Server 8.0\bin

    mysql_upgrade -uroot -padmin

    mysql -uroot -padmin

    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'admin'

    0 讨论(0)
  • 2020-11-22 05:52

    You can change the encryption of the user's password by altering the user with below Alter command :

    ALTER USER 'username'@'ip_address' IDENTIFIED WITH mysql_native_password BY 'password';

    OR

    We can avoid this error by make it work with old password plugin:

    First change the authentication plugin in my.cnf file for Linux / my.ini file in Windows:

    [mysqld]

    default_authentication_plugin=mysql_native_password

    Restart the mysql server to take the changes in affect and try connecting via MySQL with any mysql client.

    If still unable to connect and getting the below error:

    Unable to load plugin 'caching_sha2_password'
    

    It means your user needs the above plugin. So try creating new user with create user or grant command after changing default plugin. then new user need the native plugin and you will able to connect MySQL.

    Thanks

    0 讨论(0)
  • 2020-11-22 05:53

    I found that

    ALTER USER 'username'@'ip_address' IDENTIFIED WITH mysql_native_password BY 'password';
    

    didn't work by itself. I also needed to set

    [mysqld]
        default_authentication_plugin=mysql_native_password
    

    in /etc/mysql/mysql.conf.d/mysqld.cnf on Ubuntu 18.04 running PHP 7.0

    0 讨论(0)
  • 2020-11-22 05:55

    Although this shouldn't be a real solution, it does work locally if you are stuck

    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';
    
    0 讨论(0)
提交回复
热议问题