ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES) php mysql hosted on a linux server - Solution after struggling for 3 hours
Hey guys,
I broke my head for about 3 hours to solve this issue :
ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)
Tried google so many times with different possible combinations and it didnt work out.
I got the following link in bing, which was the 2nd result and it finally solved the problem.
https://help.ubuntu.com/community/MysqlPasswordReset
Here is the answer : Dont set a complex password. I had something like 12adfssdaf#$ as my password originally, then finally set it to 12asdfas34 and it worked.
Here are the commands I used in mysql :
FLUSH Privileges;
select * from user; -- this is to identify which user doesnt have password. Set passwords properly for all accounts that doesnt have a password and all accounts that has a complex password with symbols.
SET PASSWORD FOR myusername@'localhost' = PASSWORD('12aasdfdsdf34');
FLUSH Privileges;
Go and refresh your php page, it will work.
Actually I hosted in multiple different providers and had the same issue everywhere. Followed the above steps and resolved the issue everywhere. So trust me, this works!!