Category: MySQL
Created: 2020-12-22

Problem: You get the error message PHP Warning: mysqli::__construct(): The server requested authentication method unknown to the client [caching_sha2_password] in ....

Reason: You’re using MySQL 8 (manually installed from external repository) while the PHP version you’re using doesn’t support the new MySQL authentications. See the MySQL website for more information on this.

Solution: As described on the MySQL website (see link above), switch the default authentication method to mysql_native_password. On Debian-based systems, create a file /etc/mysql/mysql.conf.d/mysqld-auth.cnf with the following contents:


Then restart the MySQL server (systemctl restart mysql).