Authentication plugin 'caching_sha2_password' cannot be loaded - mysql
I am connecting MySQL - 8.0 with MySQL Workbench and getting the below error:
Authentication plugin 'caching_sha2_password' cannot be loaded:
dlopen(/usr/local/mysql/lib/plugin/caching_sha2_password.so, 2): image
not found
I have tried with other client tool as well.
Any solution for this?
you can change the encryption of the password like this.
ALTER USER 'yourusername'#'localhost' IDENTIFIED WITH mysql_native_password BY 'youpassword';
Note: For MAC OS
Open MySQL from System Preferences > Initialize Database >
Type your new password.
Choose 'Use legacy password'
Start the Server again.
Now connect the MySQL Workbench
For Windows 10:
Open the command prompt:
cd "C:\Program Files\MySQL\MySQL Server 8.0\bin"
C:\Program Files\MySQL\MySQL Server 8.0\bin> mysql -u root -p
Enter password: *********
mysql> ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'newrootpassword';
Query OK, 0 rows affected (0.10 sec)
mysql> exit
Alternatively, you can change the my.ini configuration as the following:
[mysqld]
default_authentication_plugin=mysql_native_password
Restart the MySQL Server and open the Workbench again.
I had the same problem, but the answer by Aman Aggarwal didn't work for me with a Docker container running mysql 8.X.
I loged in the container
docker exec -it CONTAINER_ID bash
then log into mysql as root
mysql --user=root --password
Enter the password for root (Default is 'root')
Finally Run:
ALTER USER 'username' IDENTIFIED WITH mysql_native_password BY 'password';
You're all set.
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
Currently (on 2018/04/23), you need to download a development release. The GA ones do not work.
I was not able to connect with the latest GA version (6.3.10).
It worked with mysql-workbench-community-8.0.11-rc-winx64.msi (from https://dev.mysql.com/downloads/workbench/, tab Development Releases).
Ok, wasted a lot of time on this so here is a summary as of 19 March 2019
If you are specifically trying to use a Docker image with MySql 8+, and then use SequelPro to access your database(s) running on that docker container, you are out of luck.
See the sequelpro issue 2699
My setup is sequelpro 1.1.2 using docker desktop 2.0.3.0 (mac - mojave), and tried using mysql:latest (v8.0.15).
As others have reported, using mysql 5.7 works with nothing required:
docker run -p 3306:3306 --name mysql1 -e MYSQL_ROOT_PASSWORD=secret -d mysql:5.7
Of course, it is possible to use MySql 8+ on docker, and in that situation (if needed), other answers provided here for caching_sha2_password type issues do work. But sequelpro is a NO GO with MySql 8+
Finally, I abandoned sequelpro (a trusted friend from back in 2013-2014) and instead installed DBeaver. Everything worked out of the box. For docker, I used:
docker run -p 3306:3306 --name mysql1 -e MYSQL_ROOT_PASSWORD=secret -d mysql:latest --default-authentication-plugin=mysql_native_password
You can quickly peek at the mysql databases using:
docker exec -it mysql1 bash
mysql -u root -p
show databases;
I was installing MySQL on my Windows 10 PC using "MySQL Web Installer" and was facing the same issue while trying to connect using MySQL workbench. I fixed the issue by reconfiguring the server form the Installer window.
Clicking on the "Reconfigure" option it will allow to reconfigure the server. Click on "Next" until you reach "Authentication Method".
Once on this tab, use the second option "Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)".
Keep everything else as is and that is how I solved my issue.
Note: For Linux (Debian, Ubuntu, Mint)
I got this error:
MySQL Error Message: Plugin caching_sha2_password could not be loaded: /usr/lib/x86_64-linux-gnu/mariadb19/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
I solved it with these steps:
Enter on mysql console: $ mysql -u root -p, if you don't have a password for root user, then:
Use mysql db: mysql> use mysql;
Alter your user for solve the problem: mysql> ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Exit... mysql> quit;
Done!
like this?
docker run -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -d mysql --default-authentication-plugin=mysql_native_password
mysql -uroot --protocol tcp
Try in PWD
https://github.com/GitHub30/docs/blob/change-default_authentication_plugin/mysql/stack.yml
or You shoud use MySQL Workbench 8.0.11.
Open MySQL Command Line Client
Create a new user with a new pass
Considering an example of a path to a bin folder on top, here's the code you need to run in the command prompt, line by line:
cd C:\Program Files\MySQL\MySQL Server 5.7\bin
MySQL -u root -p
current password...***
CREATE USER 'nativeuser'#'localhost'
IDENTIFIED WITH mysql_native_password BY 'new_password';
Then, you can access Workbench again (you should be able to do that after creating a new localhost connection and using the new credentials to start using the program).
Set up a new local host connection with the user name mentioned above (native user), login using the password (new_password)
Courtesy: UDEMY FAQs answered by Career365 Team
For Windows 10,
Modify my.ini file in C:\ProgramData\MySQL\MySQL Server 8.0\
[mysqld]
default_authentication_plugin=mysql_native_password
Restart the MySQL Service.
Login to MySQL on the command line, and execute the following commands in MySQL:
Create a new user.
CREATE USER 'user'#'localhost' IDENTIFIED BY 'password';
Grant all privileges.
GRANT ALL PRIVILEGES ON * .* TO 'user'#'localhost';
Open MySQL workbench, and open a new connection using the new user credentials.
I was facing the same issue and this worked.
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 '';
This is my databdase definition in my docker-compose:
dataBase:
image: mysql:8.0
volumes:
- db_data:/var/lib/mysql
networks:
z-net:
ipv4_address: 172.26.0.2
restart: always
entrypoint: ['docker-entrypoint.sh', '--default-authentication-plugin=mysql_native_password']
environment:
MYSQL_ROOT_PASSWORD: supersecret
MYSQL_DATABASE: zdb
MYSQL_USER: zuser
MYSQL_PASSWORD: zpass
ports:
- "3333:3306"
The relevant line there is entrypoint.
After build and up it, you can test it with:
$ mysql -u zuser -pzpass --host=172.26.0.2 zdb -e "select 1;"
Warning: Using a password on the command line interface can be insecure.
+---+
| 1 |
+---+
| 1 |
+---+
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
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
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'
If you are getting this error on GitLab CI like me:
Just change from latest to 5.7 version ;)
# .gitlab-ci.yml
rspec:
services:
# - mysql:latest (I'm using latest version and it causes error)
- mysql:5.7 #(then I've changed to this specific version and fix!)
Open my sql command promt:
then enter mysql password
finally use:
ALTER USER 'username'#'ip_address' IDENTIFIED WITH mysql_native_password BY 'password';
refer:https://stackoverflow.com/a/49228443/6097074
Thanks.
For me this started happening because on a project, I was using Docker image mysql:latest (which was version 5, and which was working fine), and during a later build, the latest version was switched to version 8, and stopped working. I changed my image to mysql:5 and I was no longer getting this error.
This error comes up when the tool being used is not compatible with MySQL8, try updating to the latest version of MySQL Workbench for MySQL8
If you still want to use the new authentication method, the proper solution is to install the mariadb-connector-c package. For Alpine, run:
apk add mariadb-connector-c
This will add the missing caching_sha2_password.so library into /usr/lib/mariadb/plugin/caching_sha2_password.so.
Almost like answers above but may be in simple queries, I was getting this error in my spring boot application along with hibernate after MySQL upgrade. We created a new user by running the queries below against our DB. I believe this is a temp work around to use sha256_password instead of latest and good authentication caching_sha2_password.
CREATE USER 'username'#'localhost' IDENTIFIED WITH mysql_native_password BY 'pa$$word';
GRANT ALL PRIVILEGES ON * .* TO 'username'#'localhost';
MySQLWorkbench 8.0.11 for macOS addresses this.
I can establish connection with root password protected mysql instance running in docker.
If you are trying to connect to a MySQL server from a text-based MySQL client from another computer (be it Docker or not)
Most answers here involve connecting from a desktop client, or ask you to switch to an older authentication method. If you're connecting it with the MySQL client (text-based), I made it work with a Debian Buster in a Docker container.
Say you have the apt system and wget set up, do the following:
sudo apt-get update
sudo apt-get install lsb-release -y
Download a Debian package which update apt sources for you from the MySQL web site.
sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb and select the options you want. In my case I only need MySQL Tools & Connectors to be enabled.
sudo apt-get update
sudo apt-get install mysql-client -y
Done. You can now run the new MySQL client and connect with the new authentication method.
The below solution worked for me
Go to Mysql Workbench -> Server-> Users and Privileges
1.Click Add Account
2.Under Login Tab provide new details and make sure to choose the Authentication Type as standard and choose respective administrative roles and Schema Privileges
Actually MySql allows two type of authentication at the time of installation.
Password Encryption
Legacy Encryption
Read Here
So by checking legacy authentication the issue was resolved.
Try using legacy password while downloading and installing MySql, that helped me.
Or follow the method posted by Santhosh Shivan for Mac OS.
Just downloaded the latest mysqlworkbench which is compatible with the latest encryption:
https://downloads.mysql.com/archives/workbench/
Note: On Mac big Sur, the latest two versions: 8.0.22 and 8.0.23 are buggy and do not work.
Use 8.0.21 until these are fixed
I run docker in M1 (arm64), the direct way of changing in the docker bash does not work for me. Instead, I change the mysql image to be
mysql:8.0.26
and the platform is set as
linux/x86_64
and add default_authentication_plugin=mysql_native_password to my.cnf
Then, you rebuild your container.
Related
Problems after installing MySql on Linux WSL
After a new installation of MySQL on WSL linux distribution a whole sequence of issues ocurred. Solutions are described on different posts, but I thought it would be good to have them on one place, since it concerns clean new installations of both mysql and WSL on a new Windows 11 PC, without any previous configuration changes, so 100% reproducible with the given versions. I followed the installation manuals for WSL and mysql expecting this would work out-of-the-box. My intention was to run MySQL instance on WSL and connect to it from MySQL Workbench running on the hosting Windows. Below is description of steps I've performed and how I solved the issues which occurred. Maybe it helps someone in the same scenario, or maybe someone can propose better solutions. WSL installation On a (new) Windows 11 PC, executed PowerShell command: wsl --install -d Ubuntu This installed Ubuntu 22.04.1 LTS In the distribution set up username/password and performed necessary updates and upgrades according to https://learn.microsoft.com/en-us/windows/wsl/install. MySQL installation According to https://learn.microsoft.com/en-us/windows/wsl/tutorials/wsl-database $ sudo apt install mysql-server This installed: mysql Ver 8.0.31-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu)) Tried to start the instance: $ sudo /etc/init.d/mysql start Following warning was reported during the instance startup: su: warning: cannot change directory to /nonexistent: No such file or directory MySQL uses a user named 'mysql' who has '/nonexistent' set up as the home directory after installation. The home directory is registered in the file '/etc/passwd'. When you open the file in an editor, you will see the line for 'mysql' user with the '/nonexistent:' directory. mysql:x:108:117:MySQL Server,,,:/nonexistent:/bin/false This directory has to be changed to an existing one, e.g.: '/var/lib/mysql'. For this the instance must be stopped first: $ sudo /etc/init.d/mysql stop Then the home directory can be set with the command: $ sudo usermod -d /var/lib/mysql/ mysql After this the instance will start without the previous warining, but the following error appeared: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) To solve this error, find where the mentioned mysqld.sock file is located. Do not stop the instance before running the command: $ sudo find / -type s Find the file in the output, in my case it was: '/run/mysqld/mysqld.sock'. Find 'my.cnf' file under '/etc', in my case: '/etc/mysql/my.cnf'. Edit this file, do not use the Windows notepad.exe, but better notepad++, in order not to change the encoding, or add extra '.txt' extension. Add following lines at the end of the file, using the exact file location: [mysql] socket=/run/mysqld/mysqld.sock I have searched for references to '/var/run' path in other .cnf files under '/etc/mysql' directory and changed them to '/run', because the '/var/run' does not exist on my distribution. After this step, the instance can be started without any errors, or warnings. Set up MySQL root user While is was possible to start mysql with: $ sudo mysql There attempt to access the instance with the root user: $ mysql -u root -p Resulted in error: Access denied for user 'root'#'localhost' (using password: NO) The user was pre-created during installation without password, but yet cannot access the instance. To fix this issue, the 'root' user needs to be re-created: $ sudo mysql mysql> drop user 'root'#'localhost'; mysql> create user 'root'#'localhost' identified by '' ; mysql> grant all privileges on *.* to 'root'#'localhost' WITH GRANT OPTION; mysql> flush privileges; Connect from Workbench running on Windows For connecting to Workbench, I've tried to use previously configured 'root' user without password. First the IP address of WSL needs to be detected. One way is to install net-tools and use ifconfig command: $ sudo apt install net-tools $ ifconfig Then, the IP address can be seen under <BROADCAST, RUNNING, MULTICAST> section in the output: eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.114.54 netmask 255.255.240.0 broadcast 192.168.127.255 Here it was 192.168.114.54 Simpler way is to get this address from Windows PowerShell command: wsl hostname -I Using this address from Workbench resulted in error connecting to the server. I've solved this problem by changing the 'bind-address' setting found in the '/etc/mysql/mysql.conf.d/mysqld.cnf' file. This was previously set to 127.0.0.1. It had to be changed to: bind-address=0.0.0.0 After this step, connection attempt from Workbench resulted in access error for the 'root' user, but it confirmed, that server was now accessible: Failed to Connect to MySQL at 192.168.114.54:3306 with user root Access denied for user 'root'#'192.168.112.1' Problem with the 'root' user accessing the instance was, that each MySQL user is bound to a specific host. In my case the 'root' was bound to 'localhost'. I needed to create a new 'root' user bound to '192.168.112.1': mysql> create user 'root'#'192.168.112.1' identified by ''; mysql> grant all privileges on . to 'root'#'192.168.112.1' WITH GRANT OPTION; mysql> flush privileges; After this step I could connect to MySQL instance from Workbench running on the hosting Windows without errors.
Why am I getting the error "Authentication plugin 'caching_sha2_password' cannot be loaded: The specified module could not be found."? [duplicate]
I am connecting MySQL - 8.0 with MySQL Workbench and getting the below error: Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/mysql/lib/plugin/caching_sha2_password.so, 2): image not found I have tried with other client tool as well. Any solution for this?
you can change the encryption of the password like this. ALTER USER 'yourusername'#'localhost' IDENTIFIED WITH mysql_native_password BY 'youpassword';
Note: For MAC OS Open MySQL from System Preferences > Initialize Database > Type your new password. Choose 'Use legacy password' Start the Server again. Now connect the MySQL Workbench
For Windows 10: Open the command prompt: cd "C:\Program Files\MySQL\MySQL Server 8.0\bin" C:\Program Files\MySQL\MySQL Server 8.0\bin> mysql -u root -p Enter password: ********* mysql> ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'newrootpassword'; Query OK, 0 rows affected (0.10 sec) mysql> exit Alternatively, you can change the my.ini configuration as the following: [mysqld] default_authentication_plugin=mysql_native_password Restart the MySQL Server and open the Workbench again.
I had the same problem, but the answer by Aman Aggarwal didn't work for me with a Docker container running mysql 8.X. I loged in the container docker exec -it CONTAINER_ID bash then log into mysql as root mysql --user=root --password Enter the password for root (Default is 'root') Finally Run: ALTER USER 'username' IDENTIFIED WITH mysql_native_password BY 'password'; You're all set.
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
Currently (on 2018/04/23), you need to download a development release. The GA ones do not work. I was not able to connect with the latest GA version (6.3.10). It worked with mysql-workbench-community-8.0.11-rc-winx64.msi (from https://dev.mysql.com/downloads/workbench/, tab Development Releases).
Ok, wasted a lot of time on this so here is a summary as of 19 March 2019 If you are specifically trying to use a Docker image with MySql 8+, and then use SequelPro to access your database(s) running on that docker container, you are out of luck. See the sequelpro issue 2699 My setup is sequelpro 1.1.2 using docker desktop 2.0.3.0 (mac - mojave), and tried using mysql:latest (v8.0.15). As others have reported, using mysql 5.7 works with nothing required: docker run -p 3306:3306 --name mysql1 -e MYSQL_ROOT_PASSWORD=secret -d mysql:5.7 Of course, it is possible to use MySql 8+ on docker, and in that situation (if needed), other answers provided here for caching_sha2_password type issues do work. But sequelpro is a NO GO with MySql 8+ Finally, I abandoned sequelpro (a trusted friend from back in 2013-2014) and instead installed DBeaver. Everything worked out of the box. For docker, I used: docker run -p 3306:3306 --name mysql1 -e MYSQL_ROOT_PASSWORD=secret -d mysql:latest --default-authentication-plugin=mysql_native_password You can quickly peek at the mysql databases using: docker exec -it mysql1 bash mysql -u root -p show databases;
I was installing MySQL on my Windows 10 PC using "MySQL Web Installer" and was facing the same issue while trying to connect using MySQL workbench. I fixed the issue by reconfiguring the server form the Installer window. Clicking on the "Reconfigure" option it will allow to reconfigure the server. Click on "Next" until you reach "Authentication Method". Once on this tab, use the second option "Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)". Keep everything else as is and that is how I solved my issue.
Note: For Linux (Debian, Ubuntu, Mint) I got this error: MySQL Error Message: Plugin caching_sha2_password could not be loaded: /usr/lib/x86_64-linux-gnu/mariadb19/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory I solved it with these steps: Enter on mysql console: $ mysql -u root -p, if you don't have a password for root user, then: Use mysql db: mysql> use mysql; Alter your user for solve the problem: mysql> ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; Exit... mysql> quit; Done!
like this? docker run -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -d mysql --default-authentication-plugin=mysql_native_password mysql -uroot --protocol tcp Try in PWD https://github.com/GitHub30/docs/blob/change-default_authentication_plugin/mysql/stack.yml or You shoud use MySQL Workbench 8.0.11.
Open MySQL Command Line Client Create a new user with a new pass Considering an example of a path to a bin folder on top, here's the code you need to run in the command prompt, line by line: cd C:\Program Files\MySQL\MySQL Server 5.7\bin MySQL -u root -p current password...*** CREATE USER 'nativeuser'#'localhost' IDENTIFIED WITH mysql_native_password BY 'new_password'; Then, you can access Workbench again (you should be able to do that after creating a new localhost connection and using the new credentials to start using the program). Set up a new local host connection with the user name mentioned above (native user), login using the password (new_password) Courtesy: UDEMY FAQs answered by Career365 Team
For Windows 10, Modify my.ini file in C:\ProgramData\MySQL\MySQL Server 8.0\ [mysqld] default_authentication_plugin=mysql_native_password Restart the MySQL Service. Login to MySQL on the command line, and execute the following commands in MySQL: Create a new user. CREATE USER 'user'#'localhost' IDENTIFIED BY 'password'; Grant all privileges. GRANT ALL PRIVILEGES ON * .* TO 'user'#'localhost'; Open MySQL workbench, and open a new connection using the new user credentials. I was facing the same issue and this worked.
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 '';
This is my databdase definition in my docker-compose: dataBase: image: mysql:8.0 volumes: - db_data:/var/lib/mysql networks: z-net: ipv4_address: 172.26.0.2 restart: always entrypoint: ['docker-entrypoint.sh', '--default-authentication-plugin=mysql_native_password'] environment: MYSQL_ROOT_PASSWORD: supersecret MYSQL_DATABASE: zdb MYSQL_USER: zuser MYSQL_PASSWORD: zpass ports: - "3333:3306" The relevant line there is entrypoint. After build and up it, you can test it with: $ mysql -u zuser -pzpass --host=172.26.0.2 zdb -e "select 1;" Warning: Using a password on the command line interface can be insecure. +---+ | 1 | +---+ | 1 | +---+
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
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
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'
If you are getting this error on GitLab CI like me: Just change from latest to 5.7 version ;) # .gitlab-ci.yml rspec: services: # - mysql:latest (I'm using latest version and it causes error) - mysql:5.7 #(then I've changed to this specific version and fix!)
Open my sql command promt: then enter mysql password finally use: ALTER USER 'username'#'ip_address' IDENTIFIED WITH mysql_native_password BY 'password'; refer:https://stackoverflow.com/a/49228443/6097074 Thanks.
For me this started happening because on a project, I was using Docker image mysql:latest (which was version 5, and which was working fine), and during a later build, the latest version was switched to version 8, and stopped working. I changed my image to mysql:5 and I was no longer getting this error.
This error comes up when the tool being used is not compatible with MySQL8, try updating to the latest version of MySQL Workbench for MySQL8
If you still want to use the new authentication method, the proper solution is to install the mariadb-connector-c package. For Alpine, run: apk add mariadb-connector-c This will add the missing caching_sha2_password.so library into /usr/lib/mariadb/plugin/caching_sha2_password.so.
Almost like answers above but may be in simple queries, I was getting this error in my spring boot application along with hibernate after MySQL upgrade. We created a new user by running the queries below against our DB. I believe this is a temp work around to use sha256_password instead of latest and good authentication caching_sha2_password. CREATE USER 'username'#'localhost' IDENTIFIED WITH mysql_native_password BY 'pa$$word'; GRANT ALL PRIVILEGES ON * .* TO 'username'#'localhost';
MySQLWorkbench 8.0.11 for macOS addresses this. I can establish connection with root password protected mysql instance running in docker.
If you are trying to connect to a MySQL server from a text-based MySQL client from another computer (be it Docker or not) Most answers here involve connecting from a desktop client, or ask you to switch to an older authentication method. If you're connecting it with the MySQL client (text-based), I made it work with a Debian Buster in a Docker container. Say you have the apt system and wget set up, do the following: sudo apt-get update sudo apt-get install lsb-release -y Download a Debian package which update apt sources for you from the MySQL web site. sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb and select the options you want. In my case I only need MySQL Tools & Connectors to be enabled. sudo apt-get update sudo apt-get install mysql-client -y Done. You can now run the new MySQL client and connect with the new authentication method.
The below solution worked for me Go to Mysql Workbench -> Server-> Users and Privileges 1.Click Add Account 2.Under Login Tab provide new details and make sure to choose the Authentication Type as standard and choose respective administrative roles and Schema Privileges
Actually MySql allows two type of authentication at the time of installation. Password Encryption Legacy Encryption Read Here So by checking legacy authentication the issue was resolved.
Try using legacy password while downloading and installing MySql, that helped me. Or follow the method posted by Santhosh Shivan for Mac OS.
Just downloaded the latest mysqlworkbench which is compatible with the latest encryption: https://downloads.mysql.com/archives/workbench/ Note: On Mac big Sur, the latest two versions: 8.0.22 and 8.0.23 are buggy and do not work. Use 8.0.21 until these are fixed
I run docker in M1 (arm64), the direct way of changing in the docker bash does not work for me. Instead, I change the mysql image to be mysql:8.0.26 and the platform is set as linux/x86_64 and add default_authentication_plugin=mysql_native_password to my.cnf Then, you rebuild your container.
The server requested authentication method unknown to the client in MySQL8.20
My knowledge in MySQL is very simple. I installed MySQL 8.20 and as here to say, the Authentication Plugin was changed. I tried as here to say, logged in to MySQL: mysql -u root -p wrote: CREATE USER 'sha2user'#'localhost' IDENTIFIED WITH caching_sha2_password BY 'password'; In my file /etc/mysql/mysql.cnf I wrote: default_authentication_plugin=caching_sha2_password and restarted MySQL: sudo systemctl restart mysq Then on my Adminer I wrote user: root and Password: my new password, but got this warning: The server requested authentication method unknown to the client Can someone please help me?
so, found the solution... My problem was how had installed ALL... I removed ALL of Mysql on my Debian, I to search what i have of Mysql and MariaDB with dpkg -l | grep -e mysql -e mariadb, than with Synaptic delete ALL then.. Than Folge all as here to say.. Now have the last Adminer, 4.7.7 and all working gut..
Connect to MySQL v8+ (Docker CE) using MySQL a v5.7 MySQL client (Ubuntu)?
I'm trying to run a MySQL database in a Docker container and connect to it from the host machine. What I do is: installing MySQL on Ubuntu host: sudo apt-get update sudo apt-get install mysql-server mysql_secure_installation The version is 5.7.11, I then install Docker CE as described here. To run my MySQL and get the IP server I do: docker run --detach --name=test-mysql --env="MYSQL_ROOT_PASSWORD=password" mysql docker inspect test-mysql | grep IPAddress I then try to connect to the MySQL database with: mysql -uroot -ppassword -h 172.17.0.2 -P 3306 And is greeted by the following: ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory I've understood that there has been changes to MySQL Authentication. It's for 8.0.4 and the version on the Docker image for MySQL seems to be 8.0.11, so I believe it's relevant. I realise that I can run an earlier version of the MySQL image as so, for example: docker run --detach --name=test-mysql --env="MYSQL_ROOT_PASSWORD=password" mysql:5 Indeed this will let me log on to the Docker Container's MySQL. I suspect I could also install a newer MySQL version, as described here. But I'd like to understand what the problem is and I'm not sure I actually have the option to switch versions around. So my questions are: Why can't I log on is it the older MySQL version which does not support the new authentication protocol? Is it possible to log on to the Docker container using this combination by changing some configuration?
You have to set default-authentication-plugin=mysql_native_password under the [mysqld] section of the MySQL 8's server (or use mysqld --default_authentication_plugin=mysql_native_password in your entrypoint/exec Docker command). This will allow MySQL 5.7 clients to connect using the legacy mysql_native_password plugin. To be safe, create the user to specifically use the mysql_native_password plugin, for example: CREATE USER 'user'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Execute mysql without sudo
I am trying to install wordpress on Odroid C2. However, wordpress could not access mysql. So, I tried this. If I execute mysql with sudo, it is OK. But, without sudo, I can't. The OS of C2 is Ubuntu Mate 16.04, so I installed mariaDB instead of mysql. I followed the guide of mariaDB installation. How can I use mysql without sudo, and how can my wordpress access the DB.
try this to solve the problem: Login in your DB sudo mysql -u root -p then make these modifications: MariaDB []>use mysql; MariaDB [mysql]>update user set plugin='' where User='root'; MariaDB [mysql]>flush privileges; MariaDB [mysql]>exit try login again without sudo
This should be an serverfault.com issues. But anyway, go through this checklist Are you starting mysql with port other than 3306 Check access of mysql client is o+rx , i.e. ls -la /usr/bin/mysql Did you grant user access other than "root" in mysqldb/mariadb. Mysql db may prevent you from using root#localhost if it is not running sudo So if in case no 3, you must create a new user and grant access to it to solve this. i.e. GRANT ALL ON <YOUR_WP_DATABASE_NAME>.* TO "wpuser"#"localhost" IDENTIFIED BY "somepassword"; Afterwards, try mysql using that user to confirm it works.