Page 1 of 1

Access denied for user 'root'@'localhost'

PostPosted: 29. March 2012 13:26
by bbgd
Hello,

I saw that this topic was already discussed and I tried all the methods described but without success.

Here is my problem:
I am try to config a sv XAMPP 1.7.3. I defined my root pass also other users. No problem. I tested, it works also in shell.
Now, when I type localhost, it loads perfectly as long as it is the xampp defaut. If I am trying to upload my site with mysql DB, it says: Access denied for user 'root'@'localhost' (using password: NO)....
I tried all the methods, modifying the config.php in my adminphp no result.

I must say that if I delete the root pass (leave it blank), my website (localhost/mysite/) loads perfectly.... what is the cause??? Anyone knows?... it is urgent.

Thank you!

Re: Access denied for user 'root'@'localhost'

PostPosted: 29. March 2012 22:21
by hackattack142
You need to be a little more clear.

You are getting this while trying to log into phpMyAdmin or via another method?

How are you setting the password?

How are you importing this database?

What is the value of $cfg['Servers'][$i]['auth_type'] in /xampp/phpmyadmin/config.inc.php?

Re: Access denied for user 'root'@'localhost'

PostPosted: 30. March 2012 06:18
by bbgd
No, I am getting this error while I am trying to access my php program on localhost. In phpmyadmin I am entering without problems with the root and it's password.
The password was set from the phpmyadmin interface.
The database is imported and it's working perfectly when I put no password for root. But when I define the password... BANG .. error... trying from my IE to access 127.0.0.1/mysite/..........

$cfg['Servers'][$i]['auth_type'] in /xampp/phpmyadmin/config.inc.php the value is cookie. I also tried the other var, but without success as long as root has a password.

Thank you for your help!

Re: Access denied for user 'root'@'localhost'

PostPosted: 30. March 2012 06:42
by Sharley
Did you you set or change the root user password using
http://localhost/security/xamppsecurity.php

You can access the full Security page from here:
http://localhost/security

With Apache and MySQL running you can click on the above links to get there.

Re: Access denied for user 'root'@'localhost'

PostPosted: 30. March 2012 09:31
by bbgd
Yes, I also tried this method, but when I'm trying to access the localhost after the pass is defined, I get the denied error.
Much simple, when I put a pass for the root, I can't access the php prg. If I delete the pass, everything works perfectly....why??

Re: Access denied for user 'root'@'localhost'

PostPosted: 30. March 2012 23:52
by hackattack142
From what you described, it is the authentication in the website you made/acquired that is failing. If you change the database for the SQL server, you need to adjust your website to use the new password. Also, it is generally not a good idea to use the root user as a general purpose account or for website interactions. It would be better to create a user that can only access the databases it needs and only has the permissions that it needs.

Re: Access denied for user 'root'@'localhost'

PostPosted: 02. April 2012 10:26
by bbgd
Thanks for your answers.

Re: Access denied for user 'root'@'localhost'

PostPosted: 10. April 2012 21:00
by calicali88
Thanks Sharley, you solved my problem.