I want to use the new DigitalOcean MySQL Managed Databases with my PHP application but I’m getting this error here:
ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
Could anyone please let me know how can I change the authentication type for my **MySQL **user from caching_sha2_password
to mysql_native_password
?
Thank you!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello,
The easiest way to fix that would be to alter your existing user with the following:
Another thing that you could do is to create a new user with
mysql_native_password
. To do that you could use the following:Also as mentioned by @kavo13, try to upgrade PHP to 7.2 as well.
After that, it should all work as normal.
I’ve created a quick video demo on how to do that:
I’m running the test on an Ubuntu 18.04 Droplet.
Hope that this helps! Regards, Bobby
I have tried pretty much everything on this page. Still same error. Interestingly enough I even used a none existing user in the connection string to see if it was even making that far and it is not. It still says returns “The server requested authentication method unknown to the client”
I did try messing with the port, etc. just to make sure it was not on my end and got the errors that I expected.
I can connect fine from Navicat and verified everything…
However when I try to connect with the following I still get the problem…
I am actually a little surprised that DO decided to go with the “new” default from MySQL 8, that very little actually supports yet, versus the standard that most already use. At the very least they should have an option at the server level versus the user level. Tons of people having the problem, after searching. (not exclusive to DO)
I just want to contribute to this thread by stating that I too was seeing the same error message after switching my WordPress (PHP) droplet from a local db to a DO managed db. I had no trouble connecting to the managed db using
mysql
at the command line, but WordPress could not connect. I tried theALTER USER
command mentioned by @bobbyiliev, but it didn’t help. I noticed a couple of people in this thread suggested upgrading to PHP 7.2. My droplet was running Ubuntu 16.04 (PHP 7.0) so I decided to upgrade to Ubuntu 18.04 (PHP 7.2). That solved the problem! Note that it is still necessary to use theALTER USER
command @bobbyiliev mentioned, but once you do that on PHP 7.2 the managed db connection works fine.Bottom line: It appears that only PHP 7.2 and above is compatible with MySQL 8.0 (the version currently used by DO’s managed MySQL dbs).