0

我正在使用 phpmyadmin 访问我的数据库,但是当我尝试访问该网站时,我收到以下错误:

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

将php连接到sql的代码如下:

    <?php
/*
 * Generated configuration file
 * Generated by: phpMyAdmin 3.2.5 setup script by Piotr Przybylski <piotrprz@gmail.com>
 * Date: Sun, 21 Feb 2010 12:43:50 +0100
 */

/* Servers configuration */
$i = 0;

/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['nopassword'] = true;

$cfg['Servers'][$i]['AllowNoPassword']      = true;
$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';




/* End of servers configuration */

$cfg['blowfish_secret']  = 'noFb57s3pq83MQVUDh9D2YLve1r8kUL2Bs27q32uBekGEzD33iTYs757G2nMt7n8';
$cfg['DefaultLang'] = 'en-utf-8';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = './tmp/';
$cfg['SaveDir'] = './tmp/';
$cfg['CheckConfigurationPermissions'] = false;
$cfg['AllowUserDropDatabase'] = true;


$cfg['MySQLManualBase'] = 'http://dev.mysql.com/doc/refman/5.1/en';
$cfg['MySQLManualType'] = 'searchable';

?>

连接是本地连接,没有密码可以输入,因此我认为数据库应该对访问进行身份验证和授权,原来它曾经可以正常工作,但现在由于某种原因,我被拒绝访问。任何帮助表示赞赏。

4

3 回答 3

2

在这种情况下,密码或用户名不正确。尝试确认并再次尝试连接。给定的脚本使用以下凭据:

用户名:root

密码:<无>

可能您丢失了正确的密码

于 2013-04-27T20:41:41.940 回答
0

首先,验证您是否安装了另一个 MySQL 实例。我想到了。

如果您的系统中只有一个 MySQL,并且您正在使用 WAMP 之类的东西,请打开您的 config.inc.php 并查找密码。

于 2013-04-27T20:47:46.593 回答
-1

在您的应用程序中使用 root 帐户不是一个好主意。始终为您的应用使用不同的用户!每个应用程序至少一个。

我敢打赌 MySQL 会阻止 root 登录。

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

让我担心的是“使用密码:否” - 没有密码的root?

尝试创建新用户,授予他对您正在处理的数据库的权限,然后重试。

于 2013-04-27T20:32:42.317 回答