14

We are using XAMPP in a shared environment in our local network. All the projects had the default mysql username and password. Recently I tried to change the user name and password of a project. And now I am not being able to access phpmyadmin. It just displays the following message:

phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

Now no one is able to access the phpmyadmin. How can I solve this?

radiopassive
  • 556
  • 1
  • 5
  • 15

14 Answers14

19

Error:-Connection for controluser as defined in your configuration failed.

solution:- because of in your ubuntu system two mysql server running so get confusion solve this problem stop mysql servert first

  1. open terminal
  2. type command:

    sudo /etc/init.d/mysql stop
    
  3. type command:

    sudo  /opt/lampp/lampp restart
    
  4. open localhost in browser
davejal
  • 6,009
  • 10
  • 39
  • 82
Rahul chak
  • 191
  • 1
  • 3
8

you can just solve this by editing the config.inc.php file from the phpmyadmin folder..

This will work fine if you edit the update password with the same username..

Find the line $cfg['Servers'][$i]['password'] =";

Just replace it with

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

Please have a look here for more details

Community
  • 1
  • 1
Avinash Babu
  • 6,171
  • 3
  • 21
  • 26
  • Avinash thanks for the reply. It worked. But the problem I am facing now is a bit weird. The phpmyadmin now shows only a few databases. Not all them. Actually most databases are not shown. Could you suggest something? – radiopassive Nov 09 '14 at 06:41
  • 2
    @freerunner You should post your additional question as a new question so that it gets the attention it deserves. Additionally, if you found Avinash Babu's answer to this question helpful, you might wish to mark it as accepted so others can see what worked for you. – Isaac Bennetch Dec 30 '14 at 02:55
7

Just add $cfg['Servers'][$i]['host']="127.0.0.1:3307"; if you change port.

Tomasz
  • 4,847
  • 2
  • 32
  • 41
Yagnesh Panchal
  • 501
  • 5
  • 4
1

There is a bat file 'resetroot.bat' located in the xammp MySQL folder ie: 'C:\xampp\mysql'

Run the bat file and it will reset the phpadmin passwords. Then start the MySQL service in xammp and try accessing phpmyadmin.

Hope it helps.

1

In my case it was just because I had forgotten to turn on the 'MySQL' service on the XAMPP control panel. *facepalm*

1

I am also getting the same error, and finally found the answer with help of first reply of above post. But that is wrong because this error prone due to changed password so all of need to do this to get resolve it. previous it look like:

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

after I changed like:

" $cfg['Servers'][$i]['password']='root'; "

The actual reason behind this while installing the XAMMP there is no password but after the that I added password for security. But it did't get updated in config.inc.php so we need to update manually by following above steps.

clemens
  • 16,716
  • 11
  • 50
  • 65
0

For my case it seems the mysql server crashed, while it was it running state without any special thing happened. My web app was connected to the db server and was ideal for long time. I was trying to open the phpmyadmin and it started to give issues(same errors mentioned in the question) while connecting to db. After 5 mins I found my db crashed and not at all starting even after trying lot of things.

Pankaj
  • 615
  • 5
  • 9
0

uninstall the xampp and reinstall it in differnt folder. but before uninstalling it please save the documents of 'htdocs' to the other location and after installing put ur data back to new "htdocs" folder

0

Remove all lines with $cfg['Servers'] , and keep ONLY the $cfg['Servers'][$i]['host']

Nana Partykar
  • 10,556
  • 10
  • 48
  • 77
Joseph
  • 1,716
  • 3
  • 24
  • 42
0

Try accessing the phpmyadmin through the "127.0.0.1:8080"

Ashraf Hefny
  • 508
  • 1
  • 6
  • 20
0

First start the Apache server.

Then click config and open phpMyAdmin(config.inc.php)

Initially you would be having this statement in your config.inc.php

      ```$cfg['Servers'][$i]['host'] = '12.0.0.0';```

Change the IP address to 'localhost:' i.e., $cfg['Servers'][$i]['host'] = 'localhost:';

I did this and the problem solved for me. Hope it helps :)

0
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
sumon cse-sust
  • 434
  • 4
  • 8
0

find this line-:

$cfg['Servers'][$i]['host'] = 'localhost';

replace it to this -:

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

it works for me.in my case I am using port 3306

David Buck
  • 3,752
  • 35
  • 31
  • 35
0

For my case, I tried to modify Then click config and open with $cfg['Servers'][$i]['host']="127.0.0.1"; then it works.

Alex Shesterov
  • 26,085
  • 12
  • 82
  • 103