I have been reading billions of answers/questions for that same error :
SQLSTATE[HY000]  Access denied for user 'root'@'ALEXPC' (using password: YES)
I myself even handle this error like hundred of times during the past 10 years.
But this case is weird : both navicat and mysql workbench can connect to this mysql 8 ( and browse things ) just fine. Just my php code (which worked well on mysql 5.7) refuses to cooperate. Same user/password.
One more strange thing, my php machine name is capitalized in the error message after the first time:
// first SQLSTATE[HY000]  Access denied for user 'dev'@'alexpc' // then SQLSTATE[HY000]  Access denied for user 'dev'@'ALEXPC'
And mysql "users and Previleges" tool says "Mysql only allows lowercase characters for hostnames, the account host will be updated accordingly".
P/s: I am using nginx-cgi on windows and php 7.3.4 php_pdo
I also set as recommended by Php website:
default_authentication_plugin = mysql_native_password