Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql said: Cannot connect: invalid settings. xampp

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.

like image 1000
Hammad Khan Avatar asked Aug 24 '11 19:08

Hammad Khan


People also ask

Why MySQL is not connecting in XAMPP?

Fixing the MySQL server not starting in XAMPP is done by reverting back the data files pre-issue. Navigate to your XAMPP MySQL directory ( C:\xampp\mysql ). Create a new folder called FIX_BACKUP . Copy C:\xampp\mysql\backup and C:\xampp\mysql\data into C:\xampp\mysql\FIX_BACKUP .


13 Answers

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.

like image 142
sohrab Avatar answered Sep 25 '22 15:09

sohrab


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';
like image 38
Alma Avatar answered Sep 25 '22 15:09

Alma


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

if u change port address

like image 43
Yagnesh Panchal Avatar answered Sep 23 '22 15:09

Yagnesh Panchal


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.

like image 27
Hammad Khan Avatar answered Sep 25 '22 15:09

Hammad Khan


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.

like image 32
Samyak Upadhyay Avatar answered Sep 23 '22 15:09

Samyak Upadhyay


I also have the problem but now solved

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

like image 35
Hairul Avatar answered Sep 23 '22 15:09

Hairul


all you have to do is stopping

mysqld.exe

from the task manager and restart the server (Xammp)

like image 30
saad mohmed Avatar answered Sep 21 '22 15:09

saad mohmed


**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
like image 27
sumon cse-sust Avatar answered Sep 21 '22 15:09

sumon cse-sust


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

sudo service mysql stop

Worked for me.

like image 43
alok Avatar answered Sep 22 '22 15:09

alok


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.

like image 36
Vinamra Jaiswal Avatar answered Sep 24 '22 15:09

Vinamra Jaiswal


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

like image 42
Muhammad Avatar answered Sep 25 '22 15:09

Muhammad


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

like image 41
Bill Gates Avatar answered Sep 24 '22 15:09

Bill Gates


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.

like image 40
Moxet Khan Avatar answered Sep 22 '22 15:09

Moxet Khan