mysql said: Cannot connect: invalid settings. xampp

PhpmyadminXampp

Phpmyadmin Problem Overview


I changed the root password to test and now I cannot login in phpMyAdmin page in XAMPP. I looked for help [here][1] and [here][2] 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. [1]: http://rudyegenias.wordpress.com/2006/09/15/enabling-phpmyadmin-once-you-change-permission-or-privileges-on-mysql-database/ [2]: http://www.apachefriends.org/f/viewtopic.php?f=16&t=30459

Phpmyadmin Solutions


Solution 1 - Phpmyadmin

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.

Solution 2 - Phpmyadmin

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';

Solution 3 - Phpmyadmin

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

if u change port address

Solution 4 - Phpmyadmin

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.

Solution 5 - Phpmyadmin

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.

Solution 6 - Phpmyadmin

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.

Solution 7 - Phpmyadmin

all you have to do is stopping

> mysqld.exe

from the task manager and restart the server (Xammp)

Solution 8 - Phpmyadmin

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

Solution 9 - Phpmyadmin

I also have the problem but now solved

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

Solution 10 - Phpmyadmin

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

sudo service mysql stop

Worked for me.

Solution 11 - Phpmyadmin

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.

Solution 12 - Phpmyadmin

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

Solution 13 - Phpmyadmin

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

Solution 14 - Phpmyadmin

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

Solution 15 - Phpmyadmin

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.

Solution 16 - Phpmyadmin

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:

Solution 17 - Phpmyadmin

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

Solution 18 - Phpmyadmin

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

Solution 19 - Phpmyadmin

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

Solution 20 - Phpmyadmin

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHammad KhanView Question on Stackoverflow
Solution 1 - PhpmyadminsohrabView Answer on Stackoverflow
Solution 2 - PhpmyadminAlmaView Answer on Stackoverflow
Solution 3 - PhpmyadminYagnesh PanchalView Answer on Stackoverflow
Solution 4 - PhpmyadminHammad KhanView Answer on Stackoverflow
Solution 5 - PhpmyadminSamyak UpadhyayView Answer on Stackoverflow
Solution 6 - PhpmyadminHairulView Answer on Stackoverflow
Solution 7 - Phpmyadminsaad mohmedView Answer on Stackoverflow
Solution 8 - Phpmyadminsumon cse-sustView Answer on Stackoverflow
Solution 9 - PhpmyadminHairulView Answer on Stackoverflow
Solution 10 - PhpmyadminalokView Answer on Stackoverflow
Solution 11 - PhpmyadminVinamra JaiswalView Answer on Stackoverflow
Solution 12 - PhpmyadminMuhammadView Answer on Stackoverflow
Solution 13 - PhpmyadminBill GatesView Answer on Stackoverflow
Solution 14 - PhpmyadminsaoView Answer on Stackoverflow
Solution 15 - PhpmyadminMoxet KhanView Answer on Stackoverflow
Solution 16 - PhpmyadminSimon HutchisonView Answer on Stackoverflow
Solution 17 - PhpmyadminSaeed ArianmaneshView Answer on Stackoverflow
Solution 18 - PhpmyadminElaGorilakiView Answer on Stackoverflow
Solution 19 - Phpmyadminaccantus_neoView Answer on Stackoverflow
Solution 20 - PhpmyadminnarenView Answer on Stackoverflow