php - 我无法访问 XAMPP phpMyAdmin;它说 : Error MySQL said: Documentation Cannot connect: invalid settings

标签 php mysql phpmyadmin xampp database-connection

完整错误信息:

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.

到目前为止,我一直在使用网络托管网站服务器;这可能搞砸了我的 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';

我可以在“localhost:8080”运行我使用 xampp 创建的 php 代码,但我无法访问 mysql。我的数据库连接配置如下:

// Databse Connection Constants
define('DB_HOST','localhost');
define('DB_USER','root');
define('DB_PASS',','');
define('DB_NAME','gallery_db');

有人可以帮忙吗?谢谢。

最佳答案

我在 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';

关于php - 我无法访问 XAMPP phpMyAdmin;它说 : Error MySQL said: Documentation Cannot connect: invalid settings,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32237044/

相关文章:

php将出生日期插入mysql

php - Laravel Eloquent 不将模型保存到数据库

php - 命名空间函数默认为全局优先

php - PDO 转义斜线

PHP MySql -- 返回列名未知的所有记录

java - JSP 表单处理

mysql - PhpMyAdmin - 可以恢复本地主机访问吗?

MySQL 默认日期时间通过 phpmyadmin

php - 您为网站推荐哪种 PHP CMS?

php - 获取统计数据并在图表中显示 - PHP/HighCharts