php 我无法访问 XAMPP phpMyAdmin;它说:错误 MySQL 说:文档无法连接:无效的设置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32237044/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
I can't access XAMPP phpMyAdmin; it says: Error MySQL said: Documentation Cannot connect: invalid settings
提问by Brian
Full error message:
完整的错误信息:
Error
MySQL said: Documentation
Cannot connect: invalid settings.
Connection for controluser as defined in your configuration failed.
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.
I have been using a web hosting site sever so far; this may have messed up my xampp connection. My phpMyAdmin "config.in.php" file is set up as follows:
到目前为止,我一直在使用网络托管站点;这可能弄乱了我的 xampp 连接。我的phpMyAdmin“config.in.php”文件设置如下:
/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';
/* Bind to the localhost ipv4 address and tcp */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
I am able to run the php codes that I have created using xampp at "localhost:8080", but I can't access mysql. My database connection configuration is as follows:
我可以在“localhost:8080”处运行我使用 xampp 创建的 php 代码,但我无法访问 mysql。我的数据库连接配置如下:
// Databse Connection Constants
define('DB_HOST','localhost');
define('DB_USER','root');
define('DB_PASS',','');
define('DB_NAME','gallery_db');
Can anyone help? Thanks.
任何人都可以帮忙吗?谢谢。
回答by Brian
I found the answer in StackOverflow. In "config.inc.php" file, I changed 'config' to 'cookie'. Here is the answer quoted from StackOverflow:
我在 StackOverflow 中找到了答案。在“config.inc.php”文件中,我将“config”改为“cookie”。这是从 StackOverflow 引用的答案:
Step 1:
Locate phpMyAdmin installation path.
Step 2:
Open phpMyAdmin>config.inc.php in your favourite text editor.
Step 3:
Search for
$cfg['Servers'][$i]['auth_type'] = 'config';
Replace it with
$cfg['Servers'][$i]['auth_type'] = 'cookie';
第1步:
找到 phpMyAdmin 安装路径。
第2步:
在您喜欢的文本编辑器中打开 phpMyAdmin>config.inc.php。
第 3 步:
搜索
$cfg['Servers'][$i]['auth_type'] = 'config';
将其替换为
$cfg['Servers'][$i]['auth_type'] = 'cookie';
回答by Amit Mhaske
I found my own answer. Steps that I followed to solve this error in XAMPP are:
我找到了我自己的答案。我在 XAMPP 中解决此错误所遵循的步骤是:
- Go to
"C:\xampp\phpMyAdmin"
- Find the file named,
"config.inc.php"
- Open this file in any text editor. (I used Sublime Text)
- Find the lines:
- 去
"C:\xampp\phpMyAdmin"
- 找到名为的文件,
"config.inc.php"
- 在任何文本编辑器中打开此文件。(我使用了 Sublime Text)
- 找到以下几行:
/* Authentication type and info */ $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = ''; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['AllowNoPassword'] = true; $cfg['Lang'] = '';
/* Authentication type and info */ $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = ''; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['AllowNoPassword'] = true; $cfg['Lang'] = '';
Provide your password here at the line:
$cfg['Servers'][$i]['password'] = 'myPassword';
Restart the XAMPP services.
在此行提供您的密码:
$cfg['Servers'][$i]['password'] = 'myPassword';
重新启动 XAMPP 服务。
Your Problem will be solved
您的问题将得到解决