Laravel 7 Digitalocean managed database error: The server requested authentication method unknown to the client

I am using Laravel 7 to do testing on DigitalOcean’s managed database cluster. Laravel connection doesn’t work, with error and I have fo find the fix that causing it.

Illuminate\Database\QueryException SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

This issue has been fixed in PHP7.4, please install PHP7.4 in the Droplet. If you are running on NGINX:

## install php7.4 fpm
$ sudo apt install php7.4 php7.4-fpm

## install php7.4 mysql
$ apt-get install php7.4-mysql

After that, update the NGINX sites configuration to the correct PHP-FPM version.

fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;

This should allow you to connect your Laravel 7 application to Digital Ocean’s managed database MySQL version 8.

This post may not 100% fix your situation, hope to bring some idea to this MySQL 8 issue in the managed database.

Few points to note :

  • DO Managed database cluster default MySQL version is 8.0, no option to select down.
  • MySQL 8.0, upgraded the password encrypting to caching_sha2_password.
  • In the managed database, if necessary create a new database username with Legacy – MySQL 5.x.
  • Ubuntu MySQL client has only version 5.7. If necessary, you need to manually install MySQL version 8 client.
  • Droplet Ubuntu version is 18.04.4 LTS.

By Keenlio, July 20, 2020

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *


four × 3 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>