I am getting this error when I try to view my newly installed Drupal 4.6.5:

Access denied for user 'user'@'localhost' (using password: YES) .. note I changed my user name to 'user' for this post.

I am using PHP 5.0.5 and MySQL 4.1.9. I used PHP MyAdmin to create database and had no problems importing table data.

I updated the settings.php page as instructed. Not sure why I'm getting this error when pointing to http://www.website.com/drupaldirectory/

Did a search and couldn't find answer. Thanks for any assistance!

Comments

Roberto Gerola’s picture

Open PHPMyAdmin and go under Privileges section and assign a password to your user.

llyra’s picture

Thanks- I figured it out. I had the wrong user listed in mySQL section.

Thanks again!

161962169’s picture

I'm having the same problem. I'm using PHP MyAdmin as well, and I cannot seem to find the "privilages" section. Could you give me more detail on what you did? It would be a great help.

Thanks in advance!

llyra’s picture

On the Right side there are two sections, one being MySQL and the other being php My Admin

Under the mySQL section (not on the sidebar but the 'main page' content) there is a text link stating privilages. Click on it and it will show you your users.

Hope this helps!

161962169’s picture

I've found where you are talking about, but dont see the link your talking about. There is a list that looks something like this:

MySQL
>Create New Database
>>No Privilages(this is under create new database, and has an X by it)
>Show processes
>Databases
>Export

I'm not sure why it is saying no privilages. Any suggestions?

thanks for all your help!

Heine’s picture

On some hosting providers you have one (pre-made) database and that's it.

On some other hosting providers you can create new databases (sometimes up to a maximum) but not via MySQL or phpmyadmin but only via the hosts control panel (CPanel, Plesk).

--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.

161962169’s picture

I am accessing my server through Plesk. I have created a new database, and a user for it. I followed the instructions for Drupal, entering the username/password of the database user into the default file.

When I open my database to work on it, It opens in a new window using MyPHPAdmin. Your thoughts?

--
Ok, will do.

Heine’s picture

Plesk doesn't provide an interface to privileges as far as I know. It's also disabled in the integrated phpmyadmin. In plesk you add users to a database as you've already done (and all should be well).

When you select the database in Plesk you see the users associated with the database. Selecting the user leads you to a screen where you can modify the password.

Make sure the password doesn't contain special characters (listed in settings.php). Double-check that the username, password and hostname in $db_url are correct. Hostname is usually localhost, but could be different for your provider.

If you really wish to grant privileges you can execute the GRANT command in INSTALL.txt in phpmyadmin; simply select the SQL tab and paste the command in the textfield; edit it to reflect your situation and press go.

Good luck.
--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.

craigdurling’s picture

I'm just new to Drupal and am experiencing the same issue. I am also using Plesk. There is another site running drupal on the same virtual server but at a different domain. In the error page I am seeing when trying to bring my site up, it makes reference to the other domain running drupal. Could this be part of my problem?

proudlyphp’s picture

Thank you in advance.

I am a newbie for cPanel. Recently, we registered for cPanel and I am assigned to administer the web-based database management system. Since we are client to the www.cpanel.net and we get the access through the username and pasword. Once we are connected to this panel, I have access to the MySql database through the username and password using and php code. That is the process.

Below is what I have been doing. I have set privileges in the PhpMyAdmin. I have given you the php connection code. And finally I tried everything with an query string, the last php code I showed you.

Users in swhisadb
swhisa_swhisa (Privileges: ALL PRIVILEGES)

And again I wrote the code inside the connecttodb.php just after connecting, as you recommended. I will show you the improved code and the new error message I got as below:

The following is the connection string.

Code: ( text )

1.

<?php
2. define
('MYSQL_HOST','localhost');
3. define('MYSQL_USER','swhisa_swhisa');
4. define('MYSQL_PASS','nd3R123');
5. define('MYSQL_DB','swhisa_swhisadb');
6. if(!mysql_connect (MYSQL_HOST, MYSQL_USER, MYSQL_PASS)){die (mysql_error()); } mysql_select_db(MYSQL_DB);
7.
8. $grt
= "GRANT ALL ON *.* TO 'swhisa_swhisa'@'%'";
9. mysql_query($grt) or die(mysql_error());
10.
11.
?>

The following is the insert query string
Code: ( text )

1.
2.
3.

<?php
4. ob_start
();
5.
6.
include ('../common/connecttodb.php');
7. echo "Connection Successful!<br>";
8.
9. $sho
= "INSERT INTO `swhisadb`.`tblsug` SET `2ma`=445";
10. mysql_query($sho) or die(mysql_error());
11.
12. header
('Location:../index.php');
13.
14. ob_end_flush
();
15.
?>

After all this, I have the following new error message: Access denied for user 'swhisa_swhisa'@'localhost' (using password: YES).

What is going wrong? Please help.

Thank you in advance.

santosh_vrose’s picture

can you send me the script?

regards
santosh

JayVGee’s picture

I am new to Drupal and I am experiencing the same problem. I downloaded the latest version of MAMP (using PHP 5 and the latest version of MySQL and Apache that comes with MAMP); I am trying to create a Dev environment in on my MacBook Pro using the latest version of Leopard. Mamp installed correctly with no problem. However, I tried creating a new USER and PASSWORD while still keeping the same root user and password. The new account should have all the correct privilages. I completed all of this through the MAMP start page. However, after logging off and logging back on i get this message when trying to start the MySQL and Apache server:
/Applications/MAMP/Library/bin/mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect

And this error with the MAMP start page opens:
Error: Could not connect to MySQL server!

I also tried changing the 'auth_type', 'user', and 'password' parameters in the "config.inc.php" file as well and that left me with little success. I have done research online with little success. Could use some assistance.

Thanks!

JayVGee

eliotr’s picture

I'm ALSO stuck getting 1045, but this may be a partial solution. (I'm quite new to drupal also. Also using MAMP, OS 10.5. and Drupal 6.15)

In drupal.org/node/66187 it recommends what is reprinted below:

So you might try using a text editor to change places in those files where a password for "root" appears. I did so initially; don't get the 1045 error often; have NOT yet seen any consequences [[REVISION: 1 hour later, when I tried to add fields using CKEditor (for first time), I couldn't do so. See my post: http://drupal.org/node/344331#comment-2483388 ]] ; but am uneasy. MAMP "help" (at bottom below) also says other scripts must be changed.

MY question -- anybody? -- is: How do I identify "other scripts which are running under MAMP" and also need to be changed?

Thanks! Eliot

========= drupal.org/node/66187 ======
Changing your password

The default username/password for your MySQL install is now root/root! For security purposes, it's always best to change this. If you're connected to the internet, this is a must.

When you are changing the default user/password from root/root, you need to do two things. Only the first is documented in the MAMP start page FAQ, but if you don't do the second then you get an error message when you try to access anything from the MAMP start page.

1. Use command line to change the password (as documented in the MAMP start page FAQ)

Open the terminal and type the following:
/Applications/MAMP/Library/bin/mysqladmin -u root -p password

It will ask for the current password after you hit enter. Once you have entered that, the MySQL password is changed.
2. Change the password in the 3 following files (this info was culled from the living-e AG forums):
* /Applications/MAMP/bin/phpMyAdmin-X.X.X/config.inc.php
* /Applications/MAMP/bin/mamp/index.php
* /Applications/MAMP/bin/stopMysql.sh (if you don't change this one you can have zombie mysqld's running after you thought you stopped the server)

========= MAMP Help on 1045 ======
How can I change the password for the MySQL database?
Open the terminal and type the following:

/Applications/MAMP/Library/bin/mysqladmin -u root -p password NEWPASSWORD

Instead of NEWPASSWORD use the new password you want.
Afterwards, you also need to change the password for phpMyAdmin and other scripts which are running under MAMP. You can change the password for phpMyAdmin in the file /Applications/MAMP/bin/phpMyAdmin-X.X.X/config.inc.php