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
For all who made all the changes and still not working, try to upgrade PHP to 7.2.
Works for me.
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).