MySQL Says: Cannot connect: invalid settings

2019-02-17 10:38发布

问题:

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?

回答1:

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



回答2:

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


回答3:

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



回答4:

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.



回答5:

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



回答6:

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.



回答7:

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



回答8:

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



回答9:

Try accessing the phpmyadmin through the "127.0.0.1:8080"



回答10:

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.