When setting up Matomo, if you’re facing an error « SQLSTATE[HY000] The server requested authentication method unknown to the client », it is likely that you are using MySQL version 8.X. In MySQL 8.X, « caching_sha2_password » is the default authentication plugin (whereas in MySQL 5.7 and prior it used to be mysql_native_password »), which can cause some issues.
To solve this issue, do either one of the following:
1) Update your existing Matomo DB user and set the appropriate authentication type by executing the following SQL query:
UPDATE `mysql`.`user` SET `plugin` = 'mysql_native_password' WHERE (`Host` = 'YOUR MATOMO DB HOST NAME') and (`User` = 'YOUR MATOMO DB USER NAME');
2) Create a new database and database user in MySQL by running the SQL queries from this FAQ, and then update your
matomo/config/config.ini.php file to reference this new DB user.