I have MySql 8.0 freshly server installed. Initially, I was able to log in, but when I tried to connect to it through PHP PDO I got this error:
Fatal error: Uncaught PDOException: PDO::__construct(): The server requested "authentication method unknown to the client [caching_sha2_password]"
I read from StackOverflow a solution here
Open your my.cnf (in my case the my.ini file) and add the following entry (and restart MySQL)
[mysqld]
default_authentication_plugin=mysql_native_password
Create a user (your MYSQL_USER name) using the correct 8.0 syntax for generating the password (see below) <---- Altered my existing user
"root"IDENTIFIED WITH mysql_native_password
Flush the privileges and try again.
After I restarted the MySql service I'm now unable to log in to MySQL. with it saying this error now:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
I want to be able to log in through PHP PDO, but I can't even log back in through regular command prompt or MySQL Workbench. Any help on this would be great.