MySQL Says: Cannot connect: invalid settings
Asked Answered
S

15

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?

Secrecy answered 9/11, 2014 at 6:16 Comment(1)
did you edit MySQL default setting in php.ini ?Capitulum
Z
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
Zygosis answered 11/10, 2016 at 9:31 Comment(1)
now your mysql server is stop if you want work with mysql that time stop xamp server and mysql restarZygosis
K
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

Kollwitz answered 9/11, 2014 at 6:25 Comment(2)
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?Secrecy
@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.Juxtapose
H
8

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

Hereat answered 14/4, 2016 at 9:16 Comment(0)
E
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.

Elaterid answered 9/11, 2014 at 6:31 Comment(0)
I
1

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

Infra answered 19/4, 2017 at 22:5 Comment(0)
D
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.

Dialyser answered 4/1, 2018 at 6:50 Comment(0)
S
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.

Swedenborgian answered 10/11, 2015 at 10:32 Comment(0)
A
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

Allgood answered 15/11, 2015 at 8:57 Comment(0)
A
0

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

Agonist answered 16/12, 2015 at 13:29 Comment(0)
H
0

Try accessing the phpmyadmin through the "127.0.0.1:8080"

Harriot answered 21/7, 2017 at 14:11 Comment(0)
C
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 :)

Craw answered 21/4, 2019 at 16:29 Comment(0)
J
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
Jansson answered 29/3, 2020 at 9:9 Comment(0)
P
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

Pontiac answered 2/5, 2020 at 5:46 Comment(0)
G
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.

Guzman answered 14/9, 2021 at 1:15 Comment(0)
W
0

If you have changed the MySQL port from the default 3306 to a different port number, you will need to update the configuration settings accordingly. First, update the MySQL port in your php.ini file to your desired port number. Then, update the following settings in your "config.inc.php" file for phpMyAdmin or any other application that needs to connect to the MySQL server.

/* Bind to the localhost ipv4 address and tcp */ $cfg['Servers'][$i]['host'] = 'localhost:3307';

Wampumpeag answered 28/5 at 10:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.