SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Mar 2012
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    #1045 - Access denied for user 'root'@'localhost' (using password: YES)

    sorry if this is asked a lot.. i found a lot of threads with the same problems but could not find a solution that worked for me.

    So I'm new at this and I was just making a test database.. just getting used to things. And I kept seeing this error on the home page of phpmyadmin that said "Your configuration file contains settings (root with no password) that correspond to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole by setting a password for user '.root'." Here's a screenshot: screen-capture-2.png

    First, I tried going to the security page.. but there was no options to change or add a password. screen-capture-1.png

    So I was all wtf. And opened the config.inc.php file and here is what it said: (added the lines for reference)
    29 /* Authentication type */
    30 $cfg['Servers'][$i]['auth_type'] = 'config';
    31 /* Server parameters */
    32 $cfg['Servers'][$i]['host'] = 'localhost';
    33 $cfg['Servers'][$i]['user'] = 'root';
    34 $cfg['Servers'][$i]['password'] = '';
    35 $cfg['Servers'][$i]['connect_type'] = 'socket';
    36 $cfg['Servers'][$i]['compress'] = false;
    37 $cfg['Servers'][$i]['AllowNoPassword'] = true;
    38 /* Select mysqli if your server has it */
    39 $cfg['Servers'][$i]['extension'] = 'mysql';


    So I changed some things and I've gotten the following errors:
    changed socket to tcp, added a password, and changed line 37 to true, false or left it blank.
    1. screen-capture-3.png
    2. screen-capture-5.png
    3. screen-capture-6.png

    2. when I click on the link "./config.inc.php" it takes me to the page - http://localhost/phpmyadmin/show_config_errors.php
    and on the page it says: Starting to parse config file...
    Parse error: syntax error, unexpected ';' in /Applications/XAMPP/xamppfiles/phpmyadmin/config.inc.php on line 37

    line 37 is: $cfg['Servers'][$i]['AllowNoPassword'] = ;
    But when I put true or false in there it gives one of the errors above.

    3. will not take my user name and password.. it refreshes and shows error #1 or 2


    Also, I am on a mac if that makes a difference. And also, I am a super php noob so if you could be as specific as possible that would be awesome.. thanks in advance for your time!

  2. #2
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,367
    Mentioned
    80 Post(s)
    Tagged
    3 Thread(s)
    Personal if it was running on your PC for testing I would not have changed it.

    Anyway you need to have Apache and Mysql running then click on the security button and then:
    => http://localhost/security/xamppsecurity.php <= [allowed only for localhost]
    ( Or whatever it is in your case as I see a different option to yours )

    Where you will have the options to change the Myphpadmin passwords etc.

    As you have been trying different things out it would probably be easier to uninstall and install again to remove what you have changed.

  3. #3
    SitePoint Member
    Join Date
    Mar 2012
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for replying...

    I'm not on a PC though. I'm using a mac.

    Apache and mysql have been running the whole time.

    I tried going to the security page from localhost but that didn't work. (second screenshot) I couldn't find anything that resembled the name xamppsecurity.php anywhere

    I really don't want to reinstall. I don't see how reinstalling would fix the problem either since I installed correctly and everything was working fine except that initial error on the phpmyadmin home page. i haven't changed anything but what i mentioned. Maybe someone could give a default config file i could use and see if that works. idk.

  4. #4
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,367
    Mentioned
    80 Post(s)
    Tagged
    3 Thread(s)
    On the bottom of your second image it says "To fix the or close these errors call Applications/XAMPP/........ That is what you want to do
    If you can undo what you did do it; it would probably take as long to uninstall and reinstall - on a PC anyway. I thought mac's had php and servers built in?

  5. #5
    SitePoint Member
    Join Date
    Mar 2012
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, I saw that. It was the first thing I looked for....... but there is no such folder or file called xampp security in the xampp folder. I don't know if macs come with php or a server... like i said I'm new to all this so its possible. anyways i want to fix this problem without reinstalling because in the future i want to figure this stuff out and not have to reinstall every time something weird happens. unless someone has some solutions i guess I'll have to but i don't see how it will fix the problem. thanks anyways.

  6. #6
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,032
    Mentioned
    152 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by zombiesarecute View Post
    2. when I click on the link "./config.inc.php" it takes me to the page - http://localhost/phpmyadmin/show_config_errors.php
    and on the page it says: Starting to parse config file...
    Parse error: syntax error, unexpected ';' in /Applications/XAMPP/xamppfiles/phpmyadmin/config.inc.php on line 37
    That's because you can't have a blank value like that in PHP; what you have now is a syntax error. And anyway that option should be either true or false, it can't be anything else (*well technically it can, but I don't want to go there).

    Quote Originally Posted by zombiesarecute View Post
    3. will not take my user name and password.. it refreshes and shows error #1 or 2
    Did you actually change your password in MySQL? The username and password in the config.php file only tell PhpMyAdmin (after here: PMA) what username and password to use for logging in to MySQL; changing the values doesn't actually change your MySQL password, but merely the password PMA uses to log in to MySQL, and as you can see when you change that value but don't change the MySQL password you get an error

    You need to open up a console and enter the commands described here --

    Code:
    /Applications/xampp/xamppfiles/mampp security
    where /Applications/xampp/xamppfiles/mampp is the command to run, and security is a parameter for that command telling it what to do -- set up the security for MySQL.

    Following you should be able to set up a password for root in MySQL. Enter that, and set the password in the PMA config to the same value.

    Also, don't use 'tcp' for connecting, 'socket' is fine.
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy


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
  •