72
votes

I changed the root password to test and now I cannot login in phpMyAdmin page in XAMPP. I looked for help here and here which basically says changed config.inc.php file in XAMPP\PHPMYADMIN folder.

/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'test';    <---- changed this
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['AllowNoPassword'] = true;

/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'test'; <--- I changed this too (Edit: Not needed)

This code below works which uses the above password

if($_SERVER['REMOTE_ADDR']=="127.0.0.1")
{
define("DATABASE_SERVER", "localhost");
define("DATABASE_USERNAME", "root");
define("DATABASE_PASSWORD", "test");
define("DATABASE_NAME", "TIGERWOODS");
} 

This happend to me bofore on Mac and I could not resolve it. Now it happened again on WinXP. I am using Xampp 1.7.4.

20

20 Answers

61
votes

I have been confronted with the same problem, so I went to :

/xampp/phpmyadmin/config.inc.php

I pasted the password which I had enter earlier then I was able to access phpmyadmin again, there in the privileges tab/ edit/ I chose no password and go then it all came back to life :)

Also you can change the user to admin but your phpmyadmin would be in admin side and your other localhost website will not work either.

45
votes

I also had the same problem and it tooks me several hours to figured out.

I just changed 'config' to 'cookie'

$cfg['Servers'][$i]['auth_type'] = 'config';
28
votes

$cfg['Servers'][$i]['host'] = '127.0.0.1:3307';

if u change port address

21
votes

The above code fixed problem for most of the ppl but I still could not login. Finally I found this (line#9 in the above code needs to be changed)

$cfg['Servers'][$i]['AllowNoPassword'] = true;   <--- change this
$cfg['Servers'][$i]['AllowNoPassword'] = false;  <--- to this fixed the problem.

Note: there are other areas in localhost where you have to change the password manually. For example in "CD Collection" example. The password is hard coded there rather than picking it up from config.inc.php.

16
votes

I also faced the same problem it was because another mysql service was running and in parallel mysql in xampp i was trying to run. So you may check that out if other solutions don't work out. You can stop that by the following command:

sudo service mysql stop

May help few users.

14
votes

Opsss. after I change user to 'admin', it doesn't have privelege to add database.. so I change back the user to 'root'.

Then I change the password from the browser.

  1. Go to http://localhost/security/ and then click on the link http://localhost/security/xamppsecurity.php . After that change pasword for superuser to 'root'.

  2. After that open your http://localhost/phpmyadmin/

    Now it works.

9
votes

all you have to do is stopping

mysqld.exe

from the task manager and restart the server (Xammp)

5
votes
**Step1**: Go to xampp/phpMyAdmin/config.inc.php
**Step2**: Search this: $cfg['Servers'][$i]['host'] = '127.0.0.1';
**Step3**: Replace with $cfg['Servers'][$i]['host'] = '127.0.0.1:3307';

Here 3307 will be change  with your mysql port number, in my case it is 3307. Most of the times it will be 3306.

You can check your mysql port number from here : xampp/mysql/bin/my.ini
4
votes

I also have the problem but now solved

$cfg['Servers'][$i]['user'] = 'admin'; - I change the user name from 'root' to 'admin'

2
votes

it may be another mysqld instance running and stoped it with:

sudo service mysql stop

Worked for me.

1
votes

Put generated password in config.inc.php if you changed root user password. I was repeatedly putting password that it asks in phpmyadmin and not generated password.

Being a noob in php and just starting out in xampp, I changed root user password and phpmyadmin has generate password button which generates password that's suppose to get updated in config.inc.php files line but it didn't so I manually updated it.

$cfg['Servers'][$i]['password'] = 'dRHfGtwfJXhzC96M'; 

On the other hand, this might also help, it involves adding a line to resetroot.bat

1
votes

In xampp\phpMyAdmin\config.inc.php : changing:

'config';$cfg['Servers'][$i]['user'] = 'root'

to

'config';$cfg['Servers'][$i]['user'] = 'user'

and

$cfg['Servers'][$i]['controluser'] = 'root'

to

$cfg['Servers'][$i]['controluser'] = 'user'

Solved my Problem.

0
votes

I faced this problem as well but i could fix it by going to the folder /xampp/phpmyadmin/config.inc.php

Open config.inc.php, u will find (if no password) ['password']= '' or (if old password) ['password']= '123'

Change the password $cfg['Servers'][$i]['password'] = 'test' and u will be able to access phpmyadmin again :)

0
votes

Best Way is reinstall if you have xampp/wamp/mamp or in linux uninstall and reinstall phpmyadmin by using apt-get

0
votes

I made changes to the config file for Laravel and completely forgot the changes. After applying everything from this thread, I had no success.

I simply overwrote the config.inc file from another xampp installation and it worked fine.

0
votes

I'm using MAMP, but looks like the exact same issue.

I changed my root password via phpMyAdmin and got locked out as described. I saw this thread and tried to get it working with the new password but the config updates didn't seem to work for me.

I tried to revert, changed the root password back, but it wasn't working, so I hunted around to try and revert my password back to the original. Eventually I discovered that for some strange reason there were multiple root users, root@localhost, [email protected], root@::1!

To get it back working basically I did this:

mysql -u root -p
mysql> use mysql;
mysql> update user set password=PASSWORD("root") where User='root';
mysql> flush privileges;
mysql> quit

After that I removed all the root users other than localhost (using phpMyAdmin), and I could still login... so, not sure why they were there in the first place.

Then, I discovered that MAMP Pro has a button under the MySQL tab that sets the root password. I'm not sure what files it edits, or services it restarts, etc... but it worked.

References:

0
votes

Solution for Windows:

  1. Stop apache & sql and close xampp
  2. Right click on xampp icon and click on Run as administrator
  3. Start apache & sql

you can also config your xampp app to always run as admin

-1
votes

I also had that problem and i did what hairul said:

  1. Go to localhost/security/
  2. Click the orange link localhost/security/xamppsecurity.php
  3. Change the password for superuser: 'root'"

then i restarted mysql on the xampp control panel and didn t work.

It only worked when i restarted my computer!!!!

-2
votes

if you are using google chrome you can fix the problem via , trying any one of the steps mentioned on this page but you need to clear your whole browsing history .... clear all the data that chrome saved onto your computer by pressing ctrl+h and the clearing all the browsing data select all the fields now restart php my admin and all will work

-2
votes

If you are facing this issue after changing password in phpmyadmin, paste the old password (passwd before change) in xampp\phpMyAdmin\config.inc.php :

$cfg['Servers'][$i]['password'] = '**old password here**';

Hope, it would work :)