【问题标题】:How do I run PHP in a local browser using Ubuntu如何使用 Ubuntu 在本地浏览器中运行 PHP
【发布时间】:2010-10-04 19:34:51
【问题描述】:

当我尝试从 XAMPP 运行 phpMyAdmin 时出现此错误。在我安装和运行 XAMPP 之前,这台机器上有一个现有的 mysql 安装。当我启动 XAMPP 时,mysql 和 apache2 都成功启动。我可以使用 PHP 脚本访问 mysql 数据库,但不能通过 phpmyadmin。

Error

MySQL said: Documentation
#1045 - Access denied for user 'root'@'localhost' (using password: NO)
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.

【问题讨论】:

  • 你在 phpmyadmin 配置文件 (config.inc.php) 中设置了正确的用户名和密码吗?

标签: php mysql xampp mysql-error-1045


【解决方案1】:

如果你想在没有密码的情况下以 root 身份访问 mysql,请确保在你的 /xampp/phpMyAdmin/config.inc.php 文件中设置了以下变量:

$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPasswordRoot'] = true;

【讨论】:

    【解决方案2】:

    您是否为 root 用户设置了密码?您不应该通过 root 连接,但请检查一下。我还记得在不允许我以 root 用户登录的 phpmyadmin 版本之一中遇到问题。

    【讨论】:

      猜你喜欢
      • 2013-06-17
      • 2020-10-08
      • 1970-01-01
      • 2012-06-24
      • 1970-01-01
      • 1970-01-01
      • 2021-11-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多