phpmyadmin - Cannot connect: invalid settings

我怕爱的太早我们不能终老 提交于 2019-12-12 03:36:14

问题


I am struggling it since hours, this is how the setup is:

  1. I installed XAMPP stack on a PC. It already had a software which installed MySQL under c:/program files/MySQL/MySQL Server 5.0. If I go to services.msc I can see two MySQL services running automatically "mysql" and "MySQLxxxx" (xxxx is name of the software).

  2. Initially MySQL service wasn't running via control panel. I changed its port to 3307 in my.ini (as my.ini in program files/mysql had port set to 3306) and "service and port settings". It runs now in XAMPP control panel.

  3. I still can't access localhost/phpmyadmin page. It says:

Error MySQL said: Documentation Cannot connect: invalid settings. 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.

=================

What am I missing? How to resolve this issue?

Edit1: Added extra information

Edit2: I changed $cfg['Servers'][$i]['auth_type'] (in config.inc.php) from config to http, now it prompts for username/password but when I enter them ('root' and 'password') it doesn't accept them.


回答1:


Since you've changed the port MySQL is using, you have to tell phpMyAdmin -- and all your other applications -- about this change.

For phpMyAdmin, edit or add a line like $cfg['Servers'][$i]['port'] = '3007';

Since you're running two MySQL instances, you can connect to both from phpMyAdmin; adapted from the wiki:

<?php 
$cfg['blowfish_secret']='0987654321'; //any string of your choice (max. 46 characters)
$i = 0;  

$i++; // server 1 
$cfg['Servers'][$i]['verbose']   = 'Production server'; 

$i++; // server 2
$cfg['Servers'][$i]['port'] = '3007';
$cfg['Servers'][$i]['verbose']   = 'Development server'; 

By the way, I prefer the auth_type 'cookie' for a few reasons; it can give better error reporting if something goes wrong when connecting, it makes it easier to switch between users and servers, and I dislike the modal dialog my browser presents for http basic authentication. Of course, you're welcome to use whatever you prefer.



来源:https://stackoverflow.com/questions/36170538/phpmyadmin-cannot-connect-invalid-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!