Error "SQLSTATE[hy000][2054] The server requested authentication method unknown to the client" with MySQL 8.0.x

I’m receiving the error as in title when trying to connect my Matomo to a MySQL database. Browsing some web pages seems to suggest that from version 8.x on the MySQL has updated the authentication method, and I should issue an “alter user” command to change the user authentication to older password-based. Tried that, but the error persists. Any insight how to solve? Should I downgrade the database to an older version? (I have an older sandbox installation with MySQL version 5.7.28 and that works OK…)

An update. I tried the various tricks to set the authentication for password, but failed. So eventually had to revert to SQL version 5.7. which then started to work. This with php 7.0 and in Ubuntu server. Looks like the main glitch is between php7.0 and sql8.0.