Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By estevan_carlos on
I randomly got this error and it shows the username for my database.
PDOException: SQLSTATE[28000] [1045] Access denied for user '******'@'localhost' (using password: YES) in lock_may_be_available() (line 165 of /home/*****/public_html/******.com/includes/lock.inc).
What exactly do I do? It's completely random. I accessed the site last night. No problems. Now this. Suggestions?
Comments
same error ... mine spits out
same error ... mine spits out Dreamhost shenanigans.
Thanks everyone!
My solution
I was having the same error message when starting an existing project on another computer. As the repository wasn't online already, I had to copy the whole D7 folder from PC1 to PC2, and import the database in phpMyAdmin. I've got this error as result when accessing my (localhost) homepage. So I went looking in the users table where I found the problem, the Drupal user for the database was missing.
To solve this problem, I started with removing the whole database. Next step I created a new user and database in phpMyAdmin, following this steps. When the users has been created, the next step is to import the existing database. To do so, I've deleted the (empty) database to prevent error messages about the database already existing. Now you can import the database of your project and you're ready to go.
I realize this might take some detour, but it's a pretty basic solution and not hard to understand for newbies like me. And it worked for me!
This worked for me, thanks!
This proposal above worked for me, thanks!
In summary, this is what I did:
Before doing all this one other advice: check and double-check the $databases values in your settings.php file, since the problem is likely there.
drupalshrek
Good proposal for me
Hello,
I had the same problem and to solve it be taking your summary.
Thanks very much very helpfull for me.
Renaming settings.php file fixed the Error
Hi,
I got this Error when I was trying to start new Drupal installation in root (it was a fullpack from the template) , when I created subfolder Drupal installation went through successfully, the major issue was that I could not leave my site under http://www.example.com/sub but I had to install under main domain name http://www.example.com/ . I could either move my existing Drupal installation from sub to root, or Install my site from scratch . I decided to start Installation from Zero , I created new Database in MySQL database with a Database user then set full set of Previleges .
What I did ''just renamed settings.php file that is located in /sites/default/ folder in the Drupal Core '' you can also Arhive this file in zip file on your server if you using Cpanel , in case you do not have Cpanel access and you are using FTP then you can simply rename settings.php file and it will fix the Error . Please Note: that is was brand new installation of Drupal, I didn't have existing site otherwise I had to follow step 1 and step 3 .
I have uploaded latest versions of Wordpress and Joomla for testing purpose in to the same directory and the installation was running with no issues .
Thank you much Drupalshrek for your helpful post .
You rule.
Thanks so much! quick summary, quick solution, easy to follow. Just what I needed.
drupalshrek it worked for me
drupalshrek it worked for me as well. Thanks for summarize it in such easy/fast to ready 3 steps
Worked for me too! Cheers
Thanks all. This post helped me.
My Issue: I deleted cached files in sites/default/files while performance cache was using. It somehow bombed the site 500 error. My site is D 7.54 and getting large.
I had a backup of web files, but the DB was 220MB and restoring was a serious challenge. At one point I wasn't sure where the issue was. Multiple attempts to restore site failed as initial DB restores could not be done in one pass. Until I saw this post and a DB tip on SO, I was drepressed. I hope my post may help someone.
My particular solution below.
1. backed up db and saved a copy of settings.php locally
2. Emptied/truncated all db cache tables
3. Created a fresh user and password on DB. Deleted the old user/pwd
4. Opened settings.php in local text editor and added new user/pwd configs
5. uploaded settings
6. Import db backup. In my case, (I have a dedicated virtual server), but the MySQL 'my.conf' file required an increase in memory to support my 220MB import. It was default set to 16MB and imports kept bombing. Even after breaking db .sql file up into multiple files the finished restore was causing other issues and I suffered much aggravation. In any event, if you have a large db to restore/import on a dedicated virtual box, set MySQL's 'my.conf' file setting to 'max_allowed_packet=64M' (article here). Mine was initially defaulted to 16MB and contributed to overall restore confusion.
Best
This Worked for me too!
Thanks this worked for me!
Summary worked fine...
Thank you drupalshrek. Summary also worked fine with me...
This Worked For Me too....
Followed same steps to re-install Drupal n then Backing my exported DB..
Thanks Buddy ...
Maybe a better solution
In the first place, make sure you checked the property "Add DROP TABLE / VIEW / PROCEDURE / FUNCTION" on the Structure part of phpMyAdmin export, and not leave it with default properties.
If you not sure, go back and make the export to the database again.
One more possibility
I fiddled with settings, removed and added databases, nothing worked. I had to remove all users (both through phpadmin and through cpanel) then re-add the users. It didn't want to accept the users I created on my computer, using localhost.
TRY THIS FIRST - QUICK FIX
Got this error after site was disabled, put offline during a backup.
When site came online this error showed for the Drupal MySQL DB.
The system thinks the drupal 'user' is still logged in and that user account in the database has a 'lock' set for it. If you are a database person, you may be able to merely reset the lock within the database; else, reset the account for drupal by swapping it with a new user account.
1. Locate the 'settings.php' file (should be in [drupal home dir]/sites/default/settings.php)
a. Find the "$databases = array ( 'default' => ..........." entry
b. The above should have the name of your database and user account information.
2. Create a new user account for the identified drupal database.
a. In my case I also gave it the exact same password, that is found in the settings.php.
b. Give it the same permissions as the original account that is listed in the settings.php.
3. Change the settings.php file 'username' entry to the new account name you created.
a. NOTE: the settings.php file has permissions set to read-only. You will have to temporarily change this to Read-Write to modify it - then change it back when done.
b. Enter the password IF you gave the new account a different password.
c. Save changes
4. Test that you can now access your site / database.
a. You can probably delete the old account name from the MySQL database after all is verified.
If this doesn't work for you, read below...some have provided more detailed actions on creating a new account name, creating a new database, and copying the old tables to the new database. Hopefully this works and you won't have to do the extra work; otherwise, it's a far better choice than rebuilding everything.
Re: TRY THIS FIRST - QUICK FIX
A lot of interesting and helpful remedies on the entire thread. Circumstances are different for all of us -- on the installation I'm using , file/folder permissions are a total mess. That said, I used PHPMyAdmin simply to reset the password and everything came roaring back.
This took me days ...
This work for me Great
Great Job, Thanx Omki
Thank you!
I have been duplicating db in order to populate new sites on a multisite and I reusing the same mysql db user.Creating brand-new user and changing the settings.php accordingly solved the issue for me. Thank you for taking the time to explain.
You were right!
I had to do some development for the website, downloaded complete website and the db to local machine and created a new user for the database to access the imported db. Updated settings.php with this new username but I was getting the above error. I had to use the same username and password and everything started working back! Thanks!
Raj Pawan G
thank u Omki Sol
Thank you Omki Solyou helped me
Quick Fix Indeed!
Thanks, been struggling with this and having read your post realised that I had been logged in when I exported the database and files. All sorted now!
Rohan
I received this same error
There are error questions here without answers despite someone posting "thanks everyone."
I received this same error. I looked at this forum http://bitnami.org/forums/forums/drupal/topics/drupal-7-install-problems-2 of a posting from someone with a similar error but nothing I modified improved the situation.
I received this same error
This looks like a mysql error. MySQL is not getting fed the correct logon information. Can you logon to mysql using your drupal credentials - either by command line or PHPMyAdmin or some other method. If you can't logon it's a credentials problem. Otherwise it's likely a path problem.
My web host has PHPMyAdmin
My web host has PHPMyAdmin but I access that by logging into my account, not specifically for MySQL. I am able to access my Drupal database using PHPMyAdmin.
My web host has PHPMyAdmin
That may be, but who is PHPMyAdmin logging in as? As your Drupal user? Or as root? Drupal may need to have access and permissions granted.
Thanks rpruitt625!
Thanks rpruitt625! I changed the settings.php userid to root and that resolved the problem. I then found that the drupal userid I was previously using had 'host' set to % where root had localhost. Changed my drupal userid to match root and updated settings.php with my original userid and that issue is now closed.
I am having this same issue,
I am having this same issue, I have changed the MySql DB password and changed it back again, still have this problem.
I'm in the middle of developing this site so this is a real hairy problem...
I am using the Bartik Theme and was having trouble getting my logo image to display, it was properly listed but after checking and unchecking the logo display options, it still wasn't appearing so I uploaded it again (it was assigned the same filename, drupal/mysql appended _0 on the end of the file name) the logo displayed.
I changed the filename in the path (still in theme settings here) back to the original filename (no appended _0) and boom, the logo wouldn't display...yes, both files are still on the server in their original locations.
That's when I logged into the DB via phpmyadmin (pair networks) to take a look at how the DB was handling the image info (path and whatnot) (I was at a loss for why this was happening and just wanted to start ruling out weirdness possibilities)
I went back to my drupal site to play with Bartik theme some more (after not finding any DB weirdness)
AND BAM!!
that's when i got this message too - referencing the same line of code.
Hope this helps because I really don't want to lose several days of constant work...
Battling PDOException: SQLSTATE[28000] [1045]
Anyone have a viable solution for this.
We were using a remote DB, then it all went horribly wrong. So we've moved back to a Local Dev build.
But having hacked WAMP to get it to work with Drupal7's requirements, we have now hit this error.
My PHP is Okay my MySql is not so great. I have tried to reconfigure the DB and grant new permissions, but I'm struggling and this seems to be a bit off the beaten track for Drupal solutions - and I have wondered into DB hacking.
From what I can see there is a conflict between the permissions for WAMP and for the D7 Db. But for the life of me I can't seem to find the correct configuration. Does anyone have any pointers they might be able to suggest or where I should be looking.
Thanks in advance. Like Audster, I am in the same boat. We have a launch deadline of March 1st and still plenty left to do.
If your in the UK or near Philly, we can buy you a beer!
Thanks/Beer in advance.
I had exactly the same error,
I had exactly the same error, checked Google and went through every post, and found some who had sorted it by finding a discrepancy between their database and username settings.
Kept checking my settings.php file and they seemed OK and I've been tearing my hair out over this.
Eventually sorted when I realized that in my settings.php file I had typed a one letter error in my database name (It was longer on my test site, but shorter on my production site)
I know it sounds silly (I checked my file half a dozen times before seeing the error) but someone else may have same problem.
In the settings.php file
The databasename, username, and password all need to be correct (obviously). In my case one letter resulted in the error.
Hope this helps someone else.
10x! It's really helps! :)
10x! It's really helps! :)
Thanks for this response.
I managed to correct this error in about 10 minutes after reading this post. Thanks!
For some reason when I was trying to do a phpmyadmin database dump to transfer to another site the database user's password in my original settings.php file was changed. Not sure how that happened but changing it back solved the problem
Bingo. Thank you. The
Bingo. Thank you. The password was wrong in the settings.php file Since it is a read only file, I used the wrong password and made it my new password in MySQL
Again - as other on this
Again - as other on this post, I solved the problem by correcting a silly typo in settings file...look, look then look again...
Yeah, me too...
Yep! I also checked my settings file repeatedly and didn't see the typo -- even though it was also visible in the error message. "Check the settings file one more time" was exactly the advice I needed (next time I have a problem I'll also remember to check whether caps lock is on and whether my computer is plugged in). Thank you!!
I went off on a bit of a wild goose chase because I thought that table locking might require slightly different permissions than regular database access. But I guess this is just the first database operation drupal tries, so if your credentials are wrong, it's the one that's going to fail. Seems like that would be a good place for a custom error message saying "the site was unable to access the database at all; please check your credentials."
Absolutely awesome! This is
Absolutely awesome! This is exactly the answer I needed: problem solved in less than two minutes. Thank you!
I owe you a beer
Thank you so much for that, such a simple solution of not having the correct DB password suddenly after my hosting made me change my cPanel login.
Took three days or so for the error to surface and was easily corrected by putting the correct DB password in the settings.php file.
I think I get the answer
I think I get the answer,the error happens because of the file settings.php we have copied from the backups for the upgrade.we followed upgrade steps (see http://drupal.org/node/570162),especially in step 8,they said,'Copy your backed up "files" and "sites" directories to the Drupal installation directory.'but by comparing the code of settings.php in D6 &D7,I find there are some differences between them,for example,about $drupal_hash_salt.the older version of setting.php in new installation doesn't completely work,that's why the error remains after checking the databasename, username, and password time and time again.when I copy a settings.php made automatically by D7 installation and modify for my drupal site,the problem is resolved.
here is settings.php in D6
here is settings.php in D7
Hmmmmmmm
Changing the password in php.ini worked for me.
I am on a hosting service and had the exact same problem the next day with another site.
I finally called them out of desperation - where we discovered that the problem was DB passworddid not match the password in php.ini file. In their case it was an error in the way the php.ini file was supposed to be updated when a password changed is done on a Drupal DB.
So, whether or not you are on a hosting service, looking into making sure your DB password matches what's in your php.ini file is probably a good first step.
MySQL port
I copied my site to a localhost, and recieved this error. in [site root]/sites/default/settings.php i changed the mysql port and it worked fine after that -
Worked around
I created a new database user and updated the settings.php file to regain access to the site.
Still being denied database access through myPhpAdmin though:
#1045 - Access denied for user 'root'@'localhost' (using password: NO)
For PDOException: SQLSTATE[28000] [1045] Access denied for user
Thank!
I had this problem too while
I had this problem too while i was moving site from localhost. in my case the solution was bad server address
on my cpanel i have found a note:
Remote MySQL Host
The mysql server's address is XXXX. When connecting to the mysql server you must specify this host.
good luck!
Same Error
I received the exact same error. My site was working fine for three days. Then I refreshed the browser, and the error occurred. Not much more to say other than it seem to be random.
**Edit**
Problem resolved. Forgot about changing the permissions on the settings.php file.
I setup a fresh ubuntu and
I setup a fresh ubuntu and dumped before all DB.
then cat the sql in the fresh db
and got that error on all local websites
And phpmyadmin said: Connection for controluser as defined in your configuration failed.
and i couldnt change passwd for any user , sth like "no such record in db "
solution was to use in the old password of debian-sys-maint
just copied the former debian.cnf to my new /etc/mysql/debian.cnf
The same problem
I got the same problem, and now everything is OK.
Ah, the platform I used is DirectAdmin v1.37.0, and, I didn't modify any file, just change the password through "MySQL Management".
Choose the Database used, and press "modify password" to change a new one(actually, it's the same password as the old), then, everything is OK.
But, this problem happened maybe because there is something wrong from the web host, I noted that there is a email sent to me about this from the host holder just after I resolved it.
Hope this can be useful for you.
New Clue
Hi,
I'm developing on a local server using OSX.
I renamed the the local directory for the particular drupal 7 site.
Then I renamed the line in /etc/hosts and the lines for the virtual host in /apache2/extra/httpd-vhosts.conf, then tried to access the site from the browser and got the error.
Restoring the directory name and the host and vhosts.conf fixes the problem.
The behaviour is different from drupal 6, using which I am able to change the site name etc without incident.
Thanks.
worked for me
this message is nothing more than the credentials are wrong.
I went into phpmyadmin, selected the database I've imported previously, clicked on rights and defined my missing user and its password.
thats it.
Hi, Just thought I'd say
Hi,
Just thought I'd say that this thread really helped me:) In the end, after wrestling with the first database, and checking and re-checking, it turned out all I needed to do was create a fresh one...pffft. So new at this!
If your a newbie like me, and have been following this thread, another excellent tutorial is here: http://learnbythedrop.com/drop/132#comment-2436
Good luck all!
My solution
The solution for me was similar to what another user posted. The permissions on settings.php preventing me from uploading the changes I made to settings.php with the new username and password.
After giving the file write permissions I was then able to save the new DB password to settings.php and upload the changes.
so..
.. what i am making every day when i stop working mostly in the evening.
i make a backup of my database(s)
i make a backup of the whole "drupal" in my htdocs of "xampp" i am using.
sometimes, when i think it is necessary (through changes there) i backup some like "php" or "apche" in "xampp" or others.
when my local "baseplace" crushed through testing one and anotherone and other stuff.. and it comes to the moment that the monitor show the words "game over"...
i make a fresh database.
make a fresh drupal minimal installation.
delete all tables.
using mostly mysgldumper to restore the backup of database
copy the backup of "drupal" and the files in it to the new installation.
having a look to several files like settings.php
and i can work with it.
it takes some moments to do that. but when i am on a testing-and-learning-pc where i can damage cause i will learn this is the easiest way:
making backups!!
do not forget!
(drupal files AND the database)
i hope someone is able to understand what i mean?
(form germany, i do not really speak - or write - english)
Access denied for user
Ce message d'erreur a certainement un grand nombre de causes possibles, ma contribution ne servira donc pas forcément à beaucoup de monde.
Je suis tombé sur ce message en voulant ouvrir mon site après l'avoir transféré chez un hébergeur.
Pour le transfert, j'avais dû ouvrir une base SQL chez l'hébergeur et fournir nom d'utilisateur et un mot de passe avant de pouvoir importer les données de la base SQL locale. Or, ils n'étaient pas identiques à ceux qui figuraient sur le fichier settings.php. En reportant sur le fichier settings les données fournies chez l'hébergeur, j'ai retrouvé l'accès à la base.
translation to english
translated to English (with some added words for clarity)
That message can be caused by any number of possibilities. My solution here may not help everyone posting here.
I came across this error message when trying to access my site after moving it to another host.
For the transfer I had to open an SQL db and provide a user name and password before I could import any data from my local db copy. Since the user name and password that I created at the new host for the db no longer matched the information in my settings.php file I had to modify the settings.php file to match the user name and password I was forced to create at the new host and now I have access.
Check your db login credentials in the setting.php file
It happens when one of your database login details is not correct and which can either be password, username. If your database does not required password, leave it empty.
* $databases['default']['default'] = array(
* 'driver' => $drive,
* 'database' => $databasename,
* 'username' => $username,
* 'password' => $password,
* 'host' => $localhost,
* 'prefix' => $prefix',
* );
Help!!!
I need help with this, ASAP. I know I've put everything in correctly. All my past databases have worked flawlessly and right away.
I used the MySQL manager to make the database. I granted the user all privileges and completed all other steps. I inputed the DB name, the user, and the password correctly and yet it rejects it. I've tried numerous databases, and all fail. I've tried making a database through MyPHPadmin, but I can't find an option to. I'm hosted on Lunarpages, at sbcforums.com. I'm new to Drupal.
I really want to get my site up. =/
You said you tried making one
You said you tried making one with PHPMyAdmin but cant find an option to. Which host are you using? Do they allow you cpanel access?
I said I was hosted by
I said I was hosted by Lunarpages in my first post. Yes, they have a control panel.
I've just uninstalled Drupal
I've just uninstalled Drupal and reinstalled it with new databases. Still not working. -_-
Is your settings.php
Is your settings.php writeable? (permissions)
Yes, 666.
Yes, 666.
The same isssu but solved
I also got the same issue because of same name for the username and database name and i changed the username then the problem is solved.
Did you just add another database?
This might happen if you add another database, and grant privileges to the Drupal user name, but with a different password, and/or forget to "flush privileges;".
I am not sure which of these two caused it, but after running this in the mysql terminal, with the original values, it works again:
grant all on YOURDATABASENAME.* to 'YOURUSERNAME' identified by 'YOURPASSWORD';
No more "PDOException: SQLSTATE[28000] [1045] Access denied for user ..."
EDIT: I just did it again, and locked myself out of my root account. This fixed it:
A possible solution to the error.
First off ask yourself, what did I change? If it worked well yesterday, how is it not working now?
If you run XAMPP like I do there's a solution described here.
XAMPP recently brought out a new security concept of authenticating access to folders. Have you actuated that?
If so the solution is simple.
Remove the MySQL access password.
I hope this helps or at the very least gives you a new angle of attack.
Adam.
I found that if your password
I found that if your password from the Old D6 was using ascii characters
converted them from the install screen to your settings.php
example:
password = Something@t643x
the @'s in the passwords would be converted to %40 for your settings.php to work
so your settings.php would have a password Something%40t643x
If like me you have one development password for several sites locally you dont want to go change every single password in every single build
D7 excepts using ascii characters directly in your settings.php unlike D6
Hope that helps someone.
To fix this login to
To fix this
login to panel
click on ''MySql Databases"
Look in the list "users with access"
Click on a user
The list "Allowable Hosts" should have the IP of your remote machine.
Enter in the IP of your remote machine you are working on
If you don't have a fixed IP then this may change at a future date and the error will return
Solution - another
For me the solution was to change, in the file php.ini, the HOST from 'localhost' into 'your_local_IP_machine'.
Hope this helps someone!..
my solution was: in pma go to
my solution was:
in pma go to needed DB
Privileges -> Edit Privileges -> in "Host" section choose "localhost" (before I used "%")
typo got me here too, i make
typo got me here too, i make mysql users via command line, instead of localhost i typed localhoast, doh!
My mistake was not choosing
My mistake was not choosing localhost when setting up the db.
I was using add new user- create DB at the same time and did not select the local host option.
absolutely nothing helped for
absolutely nothing helped for me yet. :( I may have to build a new site ONLINE as I find the upload impossible now. Same error- nothing wrong with the setting.php file.
Support at hostgator gives up as well.
Wonder what might be the issue??? I bet you anything it's mysql craziness.
If you use a decent
If you use a decent Drupal-specialist host their support will not give up. Many cheap hosts are a false economy for Drupal, inadequte support being only one of their problems. It is easy enough if you have shell access to the server (not sure whether hostgator offers that?) to log in from command line and test your database credentials to see whether they can connect.
If hostgator uses cPanel, remember that in cPanel you do not use phpmyadmin to add users to the database you have created. There is a seperate tool called Databases or My Databases or something of that kind on the far left of the databases section. You will have to add your user to the database before you import the database dump.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
I just the changed my root
I just the changed my root password for mysql by following the instructions here:
http://gnuski.blogspot.com/2012/02/resetting-mysql-root-password-red-hat...
then, I got the above error..
Thanks for reminding the setting.php file because I had to go there and update the root password with the new one.
SOLVED!
PLease Help (new user)
Hello,
Actually I am totally new to this field i.e. CMS drupal. I have got no idea about php and cms. But after watching a youtube video I tried to create a website using drupal.
After completing everything I got an error message while database configuration.
i.e. Failed to connect to your database server. The server reports the following message: SQLSTATE[28000] [1045] Access denied for user 'a1354766_neha'@'localhost' (using password: YES).
I create a database using MySQL at command line and used that but it didn't work. Then I used MySQL provided by Cpanel. And created a database and username namely:
Database: a1354766_admin
username: a1354766_neha
I have updated the settings.php file and changed the privileges to 777.
I replaced all the database, username and password with these one.
But still nothing is happening.
Please help me out. :(
Did you remember to attach
Did you remember to attach your databse user to your databse in cpanel? Three-step process 1. create db, 2. create user, 3. attach user to db.
Second possibility. Your db is @'localhost' . Some hosting company do not have the database servers at localhost. Therefore you may need to contact your hosting company to clarify this point.
Third possibility. The other common reason for the problem is a typing mistake in db name, username or password name.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
solved
this is happened to my once and the reason was the upgrade from drupal 6 to 7 ...produce a new settings.php file .. please check it in details..
Thanks everyone!
Thanks everyone! update.php and settings.php save my life
double rows in settings.php
I've got the above error just now. I've edited the settings.php, and somehow I've managed to write the mysql connect row twice (one in the middle, and one at the end) into the settings.php. After deleting one of it, my page works as usual.
solution
I got the same error when move the project into another machine. To solve the problem, You just have to edit the sites/default/settings file. If you have multiple sites, You can edit their settings files as well. In my case, i just edit the default settings file.
find and change the following section appropriate to yours
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => 'nameOftheDB',
'username' => 'nameOfDBuser',
'password' => 'DBUsersPassword',
'host' => 'localhost',
'prefix' => '',
);
Another possible solution
Maybe you've changed the listening address of your MySQL Server. I'll tell you my case:
I use Webmin to adminster my server, and MySQL listens on 127.0.0.1 by default (at least I remember so). I changed this with Webmin, so MySQL should listen on "Any" interface, but this doesn't write the expected "bind" option to my.cnf, this erase that option instead! This way, Webmin could access MySQL as before, but I got this error in Drupal 7. So I edited /etc/mysql/my.cnf by myself and put "bind=0.0.0.0" within [mysqld] section, restarted MySQL server and everything's working fine now.
Trivial Solution
I ran into the same error on one of my 25+ installations. I have no idea, what it it caused as this site is only in the make and pretty much no public traffic hits the site. However, I decided to just re-grant the rights on the database as explained in INSTALL.mysql.txt.
After this, everything was back to normal again. Weird, but sometime weird things do happen :)
Hope this helps some other scared souls.
Norbert
-- form follows function
Make sure you put your MYSQL
Make sure you put your MYSQL host address in the proper box during installation. This option is available under the advanced tab marked as important/asterisk and may go unseen if the tab isn't clicked. Doing that will solve your problem.
Reset Drupal DB password to cPanel password
I just had this problem on my site after my IP host reset my cPanel password. I had to go into sites/default /settings.php and change the database password to the cPanel password. Everything worked fine afterwards.
That is interesting. In my
That is interesting. In my experience of cPanel the database password and cPanel password are not normally the same, but maybe in some shared hosting setups they are.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
It seems to be a permissions problem
It seems that the problem is file permissions on both the database file, and its parent folder.
You have to "chmod 777" the files folder, and the .ht.sqlite db file
http://stackoverflow.com/questions/3319112/sqlite-read-only-database
Delete old settings.php
I had an old D6 settingsOLD.php file in my default directory, which Drupal decided to use in stead of settings.php, for some reason. As soon as it was deleted I could connect to the database.
Give it one more check...
I got this exact same error after moving hole site from a server to other
my fault was that I didn't change parameters correct for new server.
check your settings again...
Ubuntu Server 12.04.3 and MySQL version 5.5.34 PDO Exception
14 hours later on the PDO Exception error...
In the MySQL User database, the user permissions had to be entered multiple times for the same user name. Create one user account with a Hosts option of 127.0.0.1 another (with same user account) with hosts option of localhost and another with hosts option of the public hostname of the server. The User Permissions should now show the user name 3 times, with the 3 hosts options shown. I was using webmin to interface with ubuntu. Everything works once I followed this procedure. If you fail to generate the 3 options, you can get the PDO error.
Whew!
pg
Had the same problem for a
Had the same problem for a minute, thinking it was going to be a nightmare to put back together.. What happened in my case, I used phpMyAdmin and changed my password which caused the error in the first place. Of course I made a backup of my db's and /settings.php files but all I did to resolve the issue was edit the "old" password from the "settings.php" file and uploaded with updated password.
My case might be different than yours but if you were just trying to edit your phpMyAdmin password this should do the trick. Seamed to be a quicker fix than deleting anything.
So if you're in the same predicament hope that's a quick and easy fix. :)
My fix was...
Basically I changed my.cnf under etc folder in Centos.
I added settings that may have caused this issue.... it killed all my website and shows this error to all my websites...
Originally I added this:
open_files_limit=3662
set-variable = innodb_file_per_table=1
set-variable =
set-variable = innodb_buffer_pool_size=20M
set-variable = innodb_additional_mem_pool_size=5000K
set-variable = innodb_log_buffer_size=5000K
set-variable = innodb_thread_concurrency=6
set-variable = innodb_flush_log_at_trx_commit=0
Retrying with this:
open_files_limit=3662
set-variable = innodb_file_per_table=1
set-variable = innodb_buffer_pool_size=5M
set-variable = innodb_additional_mem_pool_size=5K
set-variable = innodb_log_buffer_size=5K
set-variable = innodb_thread_concurrency=2
set-variable = innodb_flush_log_at_trx_commit=0
So my fix?
My Fix was to empty (delete contents in file) the file my.cnf - then I rebooted server.
Wahla.
Fixed by changing database user permission
I was getting this error after moving a copy of my website from environment 1 to environment 2. In PhpMyAdmin (environment 2) I created a new user and new database with the same name, granting the user all privileges. When completing this step, I should have set the server as 'localhost', as I was using it locally, but I used the option 'any server' (%). I have then imported the dump into the new database, but the website wouldn't load, displaying the error message reported in this thread.
Entered PhpMyAdmin again and fixed the user configuration to use 'localhost' and it worked. When updating user rights in PhpMyAdmin, just make sure you check the option to remove the old user from the users table and recreate the new one with the same privileges.
For some reason importing the
For some reason importing the database and then creating the user (in that order) didn't work. I had to drop the database, create the user, re-import the database, and then give the user privileges for the database. Taking these steps resolved the problem.
This Helped me
When you get the error, hit Back on your browser and/or
- Go to Status Report
- Rebuild Permissions
- Clear all Cache
I hope this simple solution works.
Gonzalo Garcia
Freelance Webmaster
Password was the culprit here.
Password was the culprit here. Copied the password directly from the settings.php file and pasted it into the password fields for the db user. Also make sure all privileges are selected for that user.
Access denied for user
This looks like a mysql error. MySQL is not getting fed the correct logon information. Can you logon to mysql using your drupal credentials - either by command line or PHPMyAdmin or some other method. If you can't logon it's a credentials problem. Otherwise it's likely a path problem
you are right. had that
you are right. had that problem today after i imported a dump from another server. upon checking the sql file, i saw there is a db lock entry in mysql.db table. i went in and removed the users i want to remove from the table. then it worked. afterward i just add the user-database privileges again.
PDOException: SQLSTATE[HY000] [1049] Unknown database
Hi Experts,
I'm getting this error while trying to access by beta site.
PDOException: SQLSTATE[HY000] [1049] Unknown database 'drupal7_******h' in lock_may_be_available() (line 167 of /home/*****/html/drupal7/includes/lock.inc).
I've checked the mysql database name given in the settings.php is matching with the actual database which i created...and everything is fine...but still...
Kindly help me out.
If on shared hosting, check
You are better off starting a new thread because this thread is a about random failure to connect. Since you are here now I will answer.
If on shared hosting, check the documentation in case db server is not on localhost, and if necessary raise a ticket with the hosting company.
If running your own server, check the database server is running, and try connecting to the database from command line.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
Your DB isn't imported
Just import your DB wherever you moved
On Linux you can do:
mysql your_database < /usr/app/db_that_will_be_imported.sql
database error
#1045 - Access denied for user 'a1950378_lem'@'localhost' (using password: YES)
i tried creating a database for my site and it is not going through. i only receive this error what should i do.
#1045 - Access denied for user 'a1950378_lem'@'localhost' (using password: YES)
Settings.php changed on git pull
I got this error when git pulling changed the $databases = array(); settings in settings.php. Corrected the database name, username, and password and the error is gone.
A space makes a difference
As seen below, I had accidentally added a trailing space, which of course makes all the difference :-)
'password' => 'MY_PASSWORD ',
i got same issue and resolved
i got same issue and resolved after changes done in settings.php file.
Same error after migrating site to new server at same host
Thanks @omki. TRY THIS FIRST - QUICK FIX worked. All I had to do was create an new database user with all privelages, change settings.php file and my site worked.
I had the same error with acquia desktop
I had the same error when i was trying to restore a db from production to development environment with acquia desktop.
First at all i copied the sources into drupal directory then I restored the database.
The solution was copy the lines of '/Users/diego/.acquia/DevDesktop/DrupalSettings/loc_drupal_7_53_dd.inc'
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => 'drupal_7_53',
'username' => 'drupaluser',
'password' => '',
'host' => '127.0.0.1',
'port' => 33067 );
and replace settings.php statements in drupaldirectory/sites/default/files
Had the same error after moving website
In my case after moving website to new hosting I just had to change
'host' => 'localhost',
to
'host' => '127.0.0.1',
in settings.php
Check if password which you
Check if password which you are passing through settings.php is either base64 encoded or is send in any other encoded method
If you use "GoDaddy" "Installatron" read this
I use GoDaddy Shared Hosting, and I have a complex Drupal site running on a subfolder within my hosting account. It is a separate Drupal installation, not multisite, and it is accessible through a separate domain. I recently wanted to test a new site, so I created a subdomain on my main hosting account and used the convenient GoDaddy Installatron to set up a new Drupal 8 install, including a new mySQL database. Both databases user the host "localhost." Apparently, installing the second Drupal codebase and database CHANGED the username on my complex Drupal site (that is, the username of the original database). I don't know why that happened, but it created the problem described here for my original, complex site (the new site, of course, works fine). I fixed the problem by using CPanel to add a new user to the complex sites database (using the same username and password). Everything is fine now, but it was an interesting experience and I hope that my problem helps others who may be running Drupal on GoDaddy.
Thanks for all the tips! I
Thanks for all the tips! I started with the easiest one...changing password of database user. And that tip worked immediately!