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

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

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -