如何使用Ubuntu在本地浏览器中运行PHP

时间:2010-10-04 19:34:52

标签: php mysql xampp mysql-error-1045

当我尝试从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.

2 个答案:

答案 0 :(得分: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;

答案 1 :(得分:0)

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