1

首次启动 MySQL 成功设置后,出于安全原因,该页面提示我设置 ROOT 密码。

设置密码后,我不再能够访问 MySQL。错误是:

1045 - Access denied for user 'root'@'localhost' (using password: NO) 

在网上查找并尝试了config.inc.phpphpmyadmin 文件夹中的以下选项:

  1. 将身份验证设置为“http”,以便提示输入用户名和密码

    /* Authentication type */
    $cfg['Servers'][$i]['auth_type'] = 'http';
    
  2. 在配置文件中设置正确的密码

    $cfg['Servers'][$i]['password'] = 'myPwd';
    

他们都没有工作。

任何人都可以建议访问 MySQL 的解决方法吗?我并不担心无法使用 root 帐户,而是想使用其他用户名对数据库进行 CRUD。

4

1 回答 1

2

这是我的 phpmyadmin config.inc.php 文件:

<?php

$i = 0;
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

?>

如果 Apache/PHP 与 MySQL 在同一台机器上运行,这就足够了。然后将提示您输入用户名和密码。输入 root 和您设置的密码。

于 2010-03-30T01:26:36.157 回答