[Resolved] Drupal to local error: PDOException: SQLSTATE[HY000] [1045]
Posted by: massakre (---.0-85.cust.bluewin.ch)
Date: July 09, 2014 04:58PM

Hi,

I'm kind of new to Wamp and I wanted to use it to move a live site to local.
I use Drupal 7 and windows 7.

I did the following:

1) Install wamp (be sure that the green icon is there)


2) Download the drupal folder on the live site and place it in wamp/www

3) Open the setting.php file which is located in "Sites/default/setting.php" and find the username/password and the name of the database.

4) Create a new user in phpmyadmin with the name found at step 3) and the same password. Give him all the privileges. Create at the same time a new database(with the name included in the setting.php) linked to the user.

5) Make a backup of the live site database using the "backup & migrate" module and import it in the database created at step4) using phpmyadmin.


But when I want to access my site, I get the error:

PDOException: SQLSTATE[HY000] [1045] Access denied for user 'usernamehere'@'localhost' (using password: YES) in lock_may_be_available() (line 167 of C:\wamp\www\drupal\includes\lock.inc).

Anyone understand why I get this?

Thanks!



Edited 1 time(s). Last edit at 07/10/2014 07:06PM by massakre.

Options: ReplyQuote
Re: Drupal to local error: PDOException: SQLSTATE[HY000] [1045]
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: July 09, 2014 05:29PM

This is just a thought !!!?!?!

When you created the new MySQL User... did you click the Generate button ????


If you did it will have created the user but generated a new randon password for that user. You have to ignore that Generate button, manually keyin the password twice in the 2 fields and then scroll down to the Go button.


If this is what you did, click the 'Edit Privileges' link and re-enter the password in the 'Change Login Information / Copy User' section and then click the Go button at the bottom of that section.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Drupal to local error: PDOException: SQLSTATE[HY000] [1045]
Posted by: massakre (---.0-85.cust.bluewin.ch)
Date: July 09, 2014 05:32PM

Hi,

Thanks for the answer!

I did not generate a password when creating a new user tough.

I typed the password which was in the setting.php file.

Options: ReplyQuote
Re: Drupal to local error: PDOException: SQLSTATE[HY000] [1045]
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: July 09, 2014 05:51PM

Ok thats a pity. That would have been nice and easy, but here goes guess 2!


Can you change this setting in the file = \wamp\apps\phpmyadmin4.1.14\config.inc.php

Change
//$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['auth_type'] = 'config';

To
$cfg['Servers'][$i]['auth_type'] = 'cookie';
//$cfg['Servers'][$i]['auth_type'] = 'config';


Then restart the Apache service ( wampmanager -> Apache -> Service -> restart service )

Now run phpmyadmin and it should throw you a login dialog.


Now try to login using your new Drupal username and password that you created.

Does that allow you to login and can you see the database that you setup for the restore?

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Drupal to local error: PDOException: SQLSTATE[HY000] [1045]
Posted by: massakre (---.0-85.cust.bluewin.ch)
Date: July 09, 2014 06:51PM

Hi,

I made the changes in config.inc.php but unfortunatly, I don't get the login dialog when I access to phpmyadmin...

Options: ReplyQuote
Re: Drupal to local error: PDOException: SQLSTATE[HY000] [1045]
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: July 09, 2014 08:43PM

Did you restart Apache, or exit and restart Wamp?

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Drupal to local error: PDOException: SQLSTATE[HY000] [1045]
Posted by: massakre (---.0-85.cust.bluewin.ch)
Date: July 09, 2014 09:04PM

Yes, I restarted Apache.

Options: ReplyQuote
Re: Drupal to local error: PDOException: SQLSTATE[HY000] [1045]
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: July 09, 2014 09:30PM

When you changed the Drupal config did you also chnage the domain for the database server to '127.0.0.1' or 'localhost'

Looks like you are trying to connect to a different MySQL server than the one you setup on your PC.

Afraid I am just guessing here, I dont know Drupal other than a few hours playing months ago

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Drupal to local error: PDOException: SQLSTATE[HY000] [1045]
Posted by: massakre (---.0-85.cust.bluewin.ch)
Date: July 10, 2014 12:58AM

Hi,

This is what I have in the setting.php of Drupal:

$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'younidea_dru1',
'username' => 'younidea_dru1',
'password' => 'XXXXX',
'host' => 'localhost',
'port' => '',
'driver' => 'mysql',
'prefix' => 'qai_',
),
),
);


I used the same username(+password) and database name in phpmyadmin.

Options: ReplyQuote
Re: Drupal to local error: PDOException: SQLSTATE[HY000] [1045]
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: July 10, 2014 09:50AM

Ok I am stumped.

You have better try a Dripal specialist site, try a search for 'move drupal to localhost'

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Drupal to local error: PDOException: SQLSTATE[HY000] [1045]
Posted by: massakre (---.0-85.cust.bluewin.ch)
Date: July 10, 2014 07:05PM

Hi Riggsfolly, thanks for the time you have taken to answer.

I just found the solution. It seemed to be privileges issues indeed.

Here is what I've done to allow the mysql user to connect from localhost. before, only "%" had access to mysql. We have two choices

1) Either ask mysql to allow user to connect from localhost. by running this SQL "GRANT ALL PRIVILEGES ON nameoftheuser.* TO 'nameoftheuser'@'localhost' IDENTIFIED BY 'thepassword';"

[dev.mysql.com]

2) Update the setting file host field with your local IP address of machine. e.g. 192.168.10.15


Thank you!

Options: ReplyQuote
Re: [Resolved] Drupal to local error: PDOException: SQLSTATE[HY000] [1045]
Posted by: saurav-1234kumar (157.42.47.---)
Date: April 02, 2019 08:41AM

PDOException: SQLSTATE[HY000] [1045] Access denied for user 'gpbanka_lib'@'localhost' (using password: YES) in lock_may_be_available() (line 167 of C:\wamp\www\library soft and db banka\includes (1)\includes\lock.inc). How can I solved it?

Options: ReplyQuote
Re: [Resolved] Drupal to local error: PDOException: SQLSTATE[HY000] [1045]
Posted by: Otomatic (Moderator)
Date: April 02, 2019 08:59AM

Hi,

> How can I solved it?
First of all, by not interfering in a discussion that is four years old and that does not concern you in any way.
Second, by opening a new discussion by first responding to: READ (and answer) BEFORE YOU ASK A QUESTION
Third, by writing the correct code. This error does not concern Wampserver in any way but only your code and, possibly a mysql user that you have not declared.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote


Sorry, you can't reply to this topic. It has been closed.