XAMPP MySQL说:无法连接:无效的设置

时间:2019-07-10 07:07:48

标签: mysql phpmyadmin xampp

MySQL运行正常,然后无缘无故每次打开http://localhost/phpmyadmin/都会出现此错误

enter image description here

我在这里花费了数小时试图找到解决方案,但是我尝试过的所有方法都无效。

有人可以帮我吗?

我正在使用:XAMPP版本:7.3.6

谢谢

config.inc.php文件内容

<?php
/*
 * This is needed for cookie based authentication to encrypt password in
 * cookie
 */
$cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */

/*
 * Servers configuration
 */
$i = 0;

/*
 * First server
 */
$i++;

/* 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';

/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';

/* Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';

/*
 * End of servers configuration
 */

?>

7 个答案:

答案 0 :(得分:0)

要创建root用户,因为MySQL是本地的,所以请从命令行执行以下命令(“开始”>“运行”>“ cmd”不带引号):

mysqladmin -u root password 'mynewpassword'

引用Link

答案 1 :(得分:0)

$cfg['Servers'][$i]['AllowNoPassword'] = true;   <--- change this
$cfg['Servers'][$i]['AllowNoPassword'] = false;  <--- to this fixed the problem.

注意:localhost中的其他区域必须手动更改密码。例如在“ CD Collection”示例中。密码是在那里硬编码的,而不是从config.inc.php中获取的密码。

答案 2 :(得分:0)

enter image description here

运行此命令

 mysqladmin -u root password 'mynewpassword'

答案 3 :(得分:0)

  

可能是一项安全预防措施。您可以尝试添加新   管理员帐户:

mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
    ->     WITH GRANT OPTION;
mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
    ->     WITH GRANT OPTION;

https://stackoverflow.com/a/1559992/7528823

答案 4 :(得分:0)

我不知道为什么,但是由于某些原因,当我以管理员身份启动XAMPP控制面板时,我可以毫无问题地连接到phpMyAdmin

答案 5 :(得分:0)

由于提到了MariaDb服务器,因此错误消息有些令人困惑。最近对WAMP服务器进行了更改,以允许MariaDb,不知道XAMPP是否做了同样的事情。 documentation

鉴于当您以管理员身份运行时它可以工作,我想说它在正常运行时无法访问设置文件。您可以检查config.inc.php上的权限吗?

以管理员身份连接时: 您必须输入mySql用户名和密码吗? 您在数据库面板中看到了什么? 服务器:本地数据库(通过TCP / IP的127.0.0.1) 服务器类型:MySQL 服务器版本:5.7.14-MySQL社区服务器(GPL) 协议版本:10 用户:root @ localhost 服务器字符集:UTF-8 Unicode(utf8),例如:

答案 6 :(得分:0)

几分钟前我刚刚遇到了同样的问题,我确定我不需要任何配置更改,所以我所做的是清除 127.0.0.1 中的 cookie 和站点数据(在您的情况下可能是 localhost),它是解决了!