SitePoint Sponsor

User Tag List

Results 1 to 16 of 16
  1. #1
    SitePoint Member
    Join Date
    Jul 2013
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting error message about password for WAMP

    Just successfully downloaded WAMP server. Tried to open a php file in localhost. Got this error, what should I do:


    Warning: mysqli::mysqli(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in C:\wamp\www\config.php on line 6
    Call Stack
    # Time Memory Function Location
    1 0.1770 167728 {main}( ) ..\login.php:0
    2 0.4430 173456 require_once( 'C:\wamp\www\config.php' ) ..\login.php:3
    3 0.4670 174600 mysqli ( ) ..\config.php:6
    Connect Error (1045)Access denied for user 'root'@'localhost' (using password: YES)

  2. #2
    SitePoint Member
    Join Date
    Sep 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you need to configure the password of your wamp server. try the instructions here: http://www.phpmytutor.com/blogs/2012...n-wamp-server/

  3. #3
    SitePoint Member
    Join Date
    Jul 2013
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by robertboblalas View Post
    I think you need to configure the password of your wamp server. try the instructions here: http://www.phpmytutor.com/blogs/2012...n-wamp-server/
    I have a newer version of WAMP, just downloaded 4.0.4 but your link describes 3.5.1 - so the files don't match what it describes (I had already tried that link in the past). Any other thoughts?

  4. #4
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,072
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    Check that the database user that your php script is using to access MySQL, firstly that the user exists and then that it has permission to access whichever database it's trying to access
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  5. #5
    SitePoint Member
    Join Date
    Jul 2013
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SpacePhoenix View Post
    Check that the database user that your php script is using to access MySQL, firstly that the user exists and then that it has permission to access whichever database it's trying to access
    Below is a copy of the config.php file, for example. I should change DBUSERNAME? Having a challenge putting the pieces together of how to get this done.

    <?php
    define('DBHOSTNAME','localhost');
    define('DBUSERNAME','root');
    define('DBPASSWORD','root');
    define('DBNAME','yourname');

  6. #6
    SitePoint Evangelist
    Join Date
    Aug 2006
    Location
    Nantwich, Cheshire
    Posts
    452
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Can you post the php code that's failing, specifically the part where you connect to the database?
    http://www.firenza.net - my homage to a car from the 1970s

  7. #7
    SitePoint Member
    Join Date
    Jul 2013
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by droopsnoot View Post
    Can you post the php code that's failing, specifically the part where you connect to the database?
    Here's a file that fails (config.php):

    <?php
    define('DBHOSTNAME','localhost');
    define('DBUSERNAME','root');
    define('DBPASSWORD','root');
    define('DBNAME','yourname');


    And here's the error message I receive when I try to open it in localhost:

    arning: mysqli::mysqli(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in C:\wamp\www\config.php on line 6
    Call Stack
    # Time Memory Function Location
    1 0.1770 167728 {main}( ) ..\login.php:0
    2 0.4430 173456 require_once( 'C:\wamp\www\config.php' ) ..\login.php:3
    3 0.4670 174600 mysqli ( ) ..\config.php:6
    Connect Error (1045)Access denied for user 'root'@'localhost' (using password: YES)

  8. #8
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,072
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    Fire up PHPMyAdmin and click on the "Users" tab, is there a user listed there called "root"?
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  9. #9
    SitePoint Member
    Join Date
    Jul 2013
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SpacePhoenix View Post
    Fire up PHPMyAdmin and click on the "Users" tab, is there a user listed there called "root"?
    PHPMyAdmin has a list across the top of the page: Databasaes, SQL, Status, Export, Import, Settings, Variables, Charsets, Engines.

    I don't see a "Users" tab....

  10. #10
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,072
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    It might be listed as "Privileges" instead. What is the version number of PHP that you're using?
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  11. #11
    SitePoint Member
    Join Date
    Jul 2013
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SpacePhoenix View Post
    It might be listed as "Privileges" instead. What is the version number of PHP that you're using?
    It's a WAMP version: phpmyadmin version 4.0.4

    Don't see "privileges"....

  12. #12
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,072
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by scripthelper View Post
    It's a WAMP version: phpmyadmin version 4.0.4

    Don't see "privileges"....
    I've just downloaded that version and it shows "Users", can you post a screenshot of what you see (remember to blank out any passwords that are visible)?
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  13. #13
    SitePoint Member
    Join Date
    Jul 2013
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SpacePhoenix View Post
    I've just downloaded that version and it shows "Users", can you post a screenshot of what you see (remember to blank out any passwords that are visible)?
    Just fiddled with it and realized when logging into phpMyAdmin it defaulted to "mysql default db" username, but now I chose "root" username and found "Users" like you said.

    I see three users called "root" with the choices of "host" I'll list below:

    127.0.0.1
    ::1
    localhost

  14. #14
    SitePoint Evangelist
    Join Date
    Aug 2006
    Location
    Nantwich, Cheshire
    Posts
    452
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Alongside each of those, what does it say in the password column, Yes or No? My default WAMP installation (though quite a bit older than yours) defaulted to no password which I have left for testing, but you're specifying a password in that file. I wondered if it's something simple like having it configured to use a password, but not having a password set for root?
    http://www.firenza.net - my homage to a car from the 1970s

  15. #15
    SitePoint Member
    Join Date
    Jul 2013
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by droopsnoot View Post
    Alongside each of those, what does it say in the password column, Yes or No? My default WAMP installation (though quite a bit older than yours) defaulted to no password which I have left for testing, but you're specifying a password in that file. I wondered if it's something simple like having it configured to use a password, but not having a password set for root?
    It says No for all of them. How to correctly configure for a password then?

  16. #16
    SitePoint Evangelist
    Join Date
    Aug 2006
    Location
    Nantwich, Cheshire
    Posts
    452
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    On mine, you just click the 'edit' button on the far right hand end of the row for the user you want to edit, then one of the fields is to select either 'no password', or to enter a password for the account.

    Problem here is you're specifying a password, but the account is not set up for one, so you fail authentication.
    http://www.firenza.net - my homage to a car from the 1970s


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •