PDOException: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO) in lock_may_be_available() (line 167 of /home/designar/public_html/includes/lock.inc).

i have uploading my web site fro local server to web server....but again again showing the same problem
upload all files and db to the server bu t shows an error report "PDOException: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO) in lock_may_be_available() (line 167 of /home/designar/public_html/includes/lock.inc)."

Comments

klausi’s picture

Status: Active » Postponed (maintainer needs more info)

Looks like your database connection is not configured correctly on the server. Does the installation work without wsclient?

tboyd@commplus.ca’s picture

I have a similar Error. My error reads: PDOException: SQLSTATE[28000] [1045] Access denied for user 'bdaportal'@'localhost' (using password: YES) in lock_may_be_available() (line 167 of C:\Inetpub\websites\portal.bd-a.ca\includes\lock.inc).

I checked the database from the c prompt and I can certainly access it with the user name and password I have assigned it and which is in the settings file on the drupal website. I am running PHP on IIS6 on a windows Server 2003. I am setting up my back up server. I think it is a permission problem as well. Likely something to do with Windows permissions. Any one have any ideas how to track this down?

Ninjababe’s picture

Status: Postponed (maintainer needs more info) » Active

Im getting:

PDOException: SQLSTATE[HY000] [1045] Access denied for user 'dbo480773337'@'74.208.241.203' (using password: YES) in lock_may_be_available() (line 167 of /homepages/8/d479514218/htdocs/botterkloof/includes/lock.inc).

How do I fix this my first time installing new drupal on new site???

tasoslp’s picture

Assigned: Unassigned » tasoslp

i have set a password to xampp and PHPmyAdmin and when i tried to enter my site which is in localhost i am receiving the following error:
PDOException: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) in lock_may_be_available() (line 167 of C:\xampp\htdocs\drupal7\includes\lock.inc).
i have checked the files settings.php and config.inc.php and the password is set correctly.

Could you give me a tip to resolve the problem.
I am new in Drupal and PHPmyAdmin issues......

dman’s picture

Status: Active » Closed (works as designed)

This can't be anything specifically related to wsclient. Everyone reporting this here is in the wrong issue queue - this is just about the module that adds web service support.

You should probably start over in the Troubleshooting Drupal section.

petertoen’s picture

Check the privileges of you (new) database user. They may be missing!

massoumi’s picture

Issue summary: View changes

Usually this happens when your database password has been updated. In the meantime, you may have been developing a drupal website so drupal cannot connect to the database to either the root or the drupal database of your specific local website.
in "[1045] Access denied for user 'root'@'localhost' (using password: NO)" drupal cannot connect to the main database on localhost which its user is 'root'. in other words, drupal expects no password just as it mentions in the parenthesis. there are two solutions (I personally recommend you straightly apply the 2nd solution):
1. Removing the password of root user
2. Overriding drupal installation with no damages to your database.
(suppose you have 70% done, by this method you can unlock the access to the 70%)
*Note that you shouldn't drop your database at all !!!

Step by step guide for solutions:

Solution 1: Removing the password of root user:
- Run MySQL Console
(path on wamp: c:\wamp\bin\mysql\mysql5.x.x\bin\mysql.exe)
- Enter the root password in the console
(wrong password will close the console)
- to remove the password, you can update it with empty password as below:
SET PASSWORD FOR root@localhost=PASSWORD('');
- You have to inform phpMyAdmin that you have made changes to the root password.
firstly, locate config.inc.php file (on wamp: c:\Wamp\apps\phpmyadminx.x.x). Secondly, remove the password within the quotes in this line: $cfg['Servers'][$i]['password'] = 'yourpasswordhere'; (it has to look like this: $cfg['Servers'][$i]['password'] = '';) (do not forget the semicolons). lastly, set the value to TRUE for this line ($cfg['Servers'][$i]['AllowNoPassword'] = true/false;)
- Restart your server and try loading your drupal page. This will work in most cases, otherwise proceed to the 2nd one.

Solution 2. Overriding drupal installation
first, give your root user a password. run MySQL console, set password, edit phpMyAdmin's config file, restart your server, load drupal page and let's hope for the 1045 error.
- Go to your drupal website directory where you initially copied drupal core to. (you can search for the name of website you were developing on localhost)
- On your directory go to ..(name of your drupal website)/sites/default (There must be a file named settings.php)
- Make a backup file from your settings.php (simply copy it and paste right there again)
- after creating a copied version of your settings.php, delete settings.php
- Now run your (type localhost in address bar of your browser)
- in the column for YOUR PROJECTS click on your drupal website, it will then prompt you for installation.
- run standard installation, language and verification
- in Set Up Database=> (This step has to be done precisely)
for database name: enter your EXACT database you used to connect to for your drupal website,
for database username: type root
for password: type your root password
// your advanced options have to match with your previous database. (host, port, prefix)
- Save and continue
- Drupal will print out a message that such database already exists, there you have a link to view your existing website.
- this was an overriding method to your settings.php file of your drupal website.

Good Luck

kinshuksunil’s picture

I was facing the same issue.
In mysql, my user was 'user'@% (any host), since i noticed that the error message specifically mentioned lack of access to 'user'@'localhost', I updated my mysql user from user@% to user@localhost and it worked.

Not sure if this is the proper solution, but if anyone is facing this problem - worth a try!

Anonymous’s picture

Thank you kinshuksunil. That was the right solution for me.

Furkids’s picture

I have a similar issue but am not very literate at this at all.
Can someone help me please.

PDOException: SQLSTATE[HY000] [1045] Access denied for user 'furkidsa_drupal1'@'localhost' (using password: YES) in lock_may_be_available() (line 167 of /home/furkidsa/public_html/site/includes/lock.inc).

crikeymiles’s picture

Cheers kinshuksunil. That fixed it for me too.

1. Went into phpMyAdmin
2. Update my erroring user to have Host "localhost" rather than "%"
3. Works!

JonasSchindler’s picture

Hi kinkshuksunil and crikeymiles, thanks a lot! This fixed it very easily. GREAT!

Michael G’s picture

kinshuksunil,
Thank you and be blessed...
Adding the expected user with its corresponding password, worked for me.

dman’s picture

Title: PDOException: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO) in lock_may_be_available() ( » This issue is not for reporting "Access denied for user" problems

Renamed title on this old dead issue. Hopefully people will stop coming here from searches.

Sumit kumar’s picture

I was facing the same issue. i changed the database name then it's working fine.