Hello there

Hope you can help me with my problem.

When I open the following file in my browser: http://localhost/create_db.php

I am encountering the following error: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'Norlets_Admin'@'localhost' (using password: YES) in C:\wamp\www\includes\session_handler.php on line 71

The coding in the file in question, session_handler.php, is below:

66 function m_open($a, $b)
67 {
68 global $sess_db;
69
70 if ($
sess_db = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME,
71 DATABASE_PASSWORD))
72 {
73 return mysql_select_db(DATABASE_NAME, $_sess_db);
74 }
75 else
76 {
77 return false;
78 }
79 }

as far as I am aware I have granted all the necessary privileges, and I have the user, database name and password correct in the inc.config.php file (see below):

35 /************** DATABASE LOGIN *********************/
36
37 define ("DATABASE_USERNAME","Norlets_Admin");
38 define ("DATABASE_PASSWORD","pass");
39 define ("DATABASE_NAME","norlets");
40 define ("DATABASE_SERVER","localhost"); // often "localhost"

So any advice on where I'm going wrong would be greatly appreciated!

    well the error is clear, either the user-name or password is incorrect.

      Well, the first place you're going wrong is by not redacting your MySQL password on an open forum available to the entire Internet.

      Other than that, your username or password is wrong, or you're connecting to the wrong host (or wrong socket, perhaps ... it might be worth checking whether PHP is configured to use a UNIX socket or a TCP/IP port), or you don't have privileges in the database to connect at all (which seems a bit strange).

        If you're sure the database name, the user name, and password are all correct then it is likely you misconfigured permissions for the user and/or the database. I have ran into this few times using WAMP, usually I just missed something when I setup the user.

        Go into phpmyadmin click the "Privileges" tab. There should be a list of all users, click the "Edit Privleges" icon, in the last column, for the user that is setup for the database. For simplicity, make sure everything is checked in the "Global privileges" box, and that the correct database name is set in the "Database-specific privileges" box.

        If that doesn't work create a new user. I would go to that database and then use its "Privileges" tab, as the "Add a new User" link there will automatically assign the user to that database. In there make sure the "Host" is "localhost" and then check all the privileges in "Global privileges".

          5 days later

          Hi again

          I would like to thank you for your responses, especially you dagon, you are obviously a lover of newbies! :-)

          And dalecosp, that was a good point about the password which I did actually realise as soon as I had sent my original post (so I changed the password), but it was spotted in moderation anyhow.

          Krik, I did what you suggested as I was sure that the username and password were all correct, and it worked… however, it has brought up another problem.

          When I have created the norlets database, and run the create_db.php file it brings up the error message "Error - database already exists! If you want to create a new database delete the old one first.", yet if I delete the database and then run it it comes up with the message "Could not select database". Is this anything you could help me with or is this specific to the package I am trying to adapt?

          Also, where should my pear libraries directory be in relation to my wamp directory?

          Many thanks in advance, and apologies for coming across as seemingly thick, but I am definitely a newbie! :-)

          Mark

            Write a Reply...