#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:

First, I tried going to the security page… but there was no options to change or add a password.

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. 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.

  1. 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!

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.

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.

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?

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.

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).

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 :slight_smile:

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

/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.