I am getting this error after i completed my site and was adding media galley module

PDOException: SQLSTATE[42000] [1044] Access denied for user 'vermasee_drpl1'@'localhost' to database 'vermasee_drpl1' in lock_may_be_available() (line 165 of /home/vermasee/public_html/includes/lock.inc).

Plz help me to solve this issue


WorldFallz’s picture

Please don't post duplicate threads. I've deleted the dupe, thanks.

Care about the future of the Drupal.org forums? Please join our conversation and show support for improving the forums infrastructure.

NotNotCow’s picture

Could you point me in the direction of where this thread was answered?

I have the exact same error message, and can't seem to find the duplicate thread with the response?

Thanks in advance


NotNotCow’s picture

Ignore me, fixed it...

WorldFallz’s picture

and why not post your solution here for the benefit of others that find this page as you did?

Care about the future of the Drupal.org forums? Please join our conversation and show support for improving the forums infrastructure.

NotNotCow’s picture

...sleep? Who can tell...

The solution as it turns out was pretty simple.

To give others some background, I was moving a site from a sub domain to a new host, and I came up with a few errors, the major one being the start of this thread.

Firstly, I had not exported my database from php my admin with the correct values.

BACK UP everything first mind:)

So the first step was to delete any databases and essentially start again.

I then re-exported the Database.

There is an excellent tutorial here from Learn by the drop: http://learnbythedrop.com/drop/132#comment-2436

This tutorial gives you the correct values for exporting the DB. (look around 6:22 in the vid) and walks you through the process..

Although based around Druapl 6, it works just as well for Drupal 7(2). Please note that you don't need to find/edit the url_db line, as it doesn't exist in settings.php (D7).

Again following the above tutorial, I completely removed the new site, re-installed it with Filezilla, and then imported the new database with the correct values (all done with php my admin).

I then edited the settings.php file to reflect the correct Username, password. (Again the tutorial does a much better job of explaining the process than I can:). And hey presto, problem solved.

I did have other issues, but these were actually down to a bad Download/upload, so lines were missing from some of my inc files. Using a previous back-up sorted the parse errors.

Anyhoo, I hope this is useful. Learn by the drop also have an excellent tut on upgrading the core, again for Drupal 6, but I can testify that it works just as well for upgrading from D7 to D7.2.



WorldFallz’s picture

lol, thanks for posting it back-- I'm sure it will help someone else!

Care about the future of the Drupal.org forums? Please join our conversation and show support for improving the forums infrastructure.

veganline’s picture

http://drupal.org/node/76156 is a thread about increasing memory limits.
One of the solutions, which works on my shared server space, is to add a line to settings.php like
"ini_set('memory_limit', '128M');"
So in the trial and error it is easy to re-use a settings.php file because it has a hand-written memory limit in it.
Unfortunately this copy had user, pass, and database names written by software during previous installations.
Solution: hand-write the memory setting - whatever it says in the thread above - each time.
Hope this helps someone

Als’s picture

The base interpretation of this problem is that Mysql won't let Drupal read from the database.

Get Drupal's username and db name from settings.php, then check Mysql privileges. Most likely you will find the user in the table, but without privileges for the needed database.

Give the user "all privileges", without GRANT, for the required database, then flush privileges to let Mysql know of the change. Reload the home page of your site and the error should be gone.

This is the heart of the problem. It can be solved in 5 minutes without overshooting (delete the database, re-upload the site etc). Of course it might be necessary to fine-tune this generic solution for a particular situation.

markwith’s picture

I guess I got "removed" and pointed over here.

I guess I needed to go back and rewatch that video. I went very cautiously and set everything just right. Don't know what I had wrong, but like everyone says, you have to do it EXACTLY! The whole key is in the mysql export!

Thanks to all who took the time to assist me.

scurvy’s picture

I got this error once when I imported the database correctly, uploaded the files correctly, and created the user correctly. I just forgot to grant the user permissions on the database. Perhaps that will help someone.

fatiharchitecture’s picture

the problem is all about correctness of dbname,dbusername password and etc. when I got this error first time I spend one hour and I realized that I wrote the host wrong. second I got this error, I realized that I did not grant the permissions, because on cpanel there is two points: first;create user and second submit user. I didn't click to submit user to database. solution is so simple.

timxhr877’s picture

Being new to cPanel, I didn't realize I needed to submit the user. This solution worked for me.

ALS's comment: "Give the user "all privileges", without GRANT, for the required database, then flush privileges to let Mysql know of the change." is a little confusing. I don't know how to give the user all privileges without using Grant. Otherwise, it seems similar to fatiharchitecture's solution here.

dangswiss’s picture

I had the same issue and I was using cPanel on HostGator for this client. Drupal 7.18 version.

For me the solution was to "add" the mysql user to my db (I admit that I forgot this little detail when I cloned the db) and then grant all db privileges to that user. Really simple. I did not have to flush the mysql cache and it worked right away.

kshankin’s picture

Thanks, this is just what I needed as I had the same issue. I can't believe that it was that simple...

miguelfrias’s picture

In my case, the user I had, has no permission to that database. So I just grant all privileges to that database.

wingman1985’s picture

I am using WampServer and I had the same problem : "Failed to connect to your database server. The server reports the following message: SQLSTATE[42000] [1044] Access denied for user ''@'localhost' to database 'drupal'." My privilieges are all OK but I still get this message. I am confused here.

dharmanerd’s picture

I'm able to interact w/ mysql from the command line using the same user credentials, but can't access from Drupal after migration.

Finally figured it out. Database name wasn't spelled correctly. Reminds me of the time I was trying to fix a computer and probably spent half an hour troubleshooting it til i realized it was unplugged. : )

sander-martijn’s picture

same problem here - the database name changed as part of the migration. I remembered to change the host, username and password but forgot to change the database name. I really wish these error messages were more descriptive. That said even the permissions explanations by earlier users set me down on the right path to figuring it out.

varsha02’s picture

i also face same problem and solve it as in cpanel -->mysqldatabase
Add User To Database
User: abc
Database: bac
add button

Current Users
here i create new database , and new user but

i was just missing to click on add button that will set permission all privilage to connect user with database . and after select all privilages this problem will solve . and also please do chk all db detail are same in settings.php