php - PDO connection refuses access -


i trying add records database using pdo make code more secure. gives me connection error:

sqlstate[28000] [1045] access denied user 'root'@'localhost' (using password: yes) 

the connection file includes 2 scripts, 1 regular mysql , second 1 new pdo. first 1 working well, pdo throws error. doing wrong on here?

edit: code deleted due shieet

your first connection 127.0.0.1, while second connections localhost.

they might same, server (mysql) side not. use 127.0.0.1 in pdo line , should work.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -