#1045-用户'root'@'localhost'的访问被拒绝(使用密码:是和否)

时间:2018-08-17 22:39:40

标签: phpmyadmin wampserver

我改变了笔记本电脑的强度,因此重新安装程序,因此我安装了wamp服务器,并且当尝试从浏览器访问localhost时,用户名和密码页面 所以我输入用户名root,密码为空,但出现此错误:

  

1045-用户'root'@'localhost'的访问被拒绝(使用密码:否)

所以我通过添加密码来更改 config.inc.php 文件,并将允许密码从true更改为false

这是文件:

<?php

/* Servers configuration */
$i = 0;

$cfg['blowfish_secret'] = 'h]C+{nqW$omNoTIkCwC$%z-LTcy%p6_j$|$Wv[mwngi~|e'; //What you want

//Checking Active DBMS Servers
$wampConf = @parse_ini_file('../../wampmanager.conf');
//Check if MySQL and MariaDB with MariaDB on default port
$mariaFirst = ($wampConf['SupportMySQL'] == 'on' && $wampConf['SupportMariaDB'] == 'on' && $wampConf['mariaPortUsed'] == $wampConf['mysqlDefaultPort']) ? true : false;
if($wampConf['SupportMySQL'] == 'on') {
/* Server: localhost [1] */
    $i++;
    if($mariaFirst) $i++;
    $cfg['Servers'][$i]['verbose'] = 'MySQL';
    $cfg['Servers'][$i]['host'] = 'localhost';
    $cfg['Servers'][$i]['port'] = $wampConf['mysqlPortUsed'];
    $cfg['Servers'][$i]['compress'] = false;
    $cfg['Servers'][$i]['connect_type'] = 'tcp';
    $cfg['Servers'][$i]['extension'] = 'mysqli';
    $cfg['Servers'][$i]['auth_type'] = 'cookie';
    $cfg['Servers'][$i]['user'] = 'root';
    $cfg['Servers'][$i]['password'] = 'root';

    // Hidden databases in PhpMyAdmin left panel
    //$cfg['Servers'][$i]['hide_db'] = '(information_schema|mysql|performance_schema|sys)';

    // Allow connection without password
    $cfg['Servers'][$i]['AllowNoPassword'] = false;
}
/* Server: localhost [2] */
if($wampConf['SupportMariaDB'] =='on') {
    $i++;
    if($mariaFirst) $i -= 2;
    $cfg['Servers'][$i]['verbose'] = 'MariaDB';
    $cfg['Servers'][$i]['host'] = 'localhost';
    $cfg['Servers'][$i]['port'] = $wampConf['mariaPortUsed'];
    $cfg['Servers'][$i]['compress'] = false;
    $cfg['Servers'][$i]['connect_type'] = 'tcp';
    $cfg['Servers'][$i]['extension'] = 'mysqli';
    $cfg['Servers'][$i]['auth_type'] = 'cookie';
    $cfg['Servers'][$i]['user'] = 'root';
    $cfg['Servers'][$i]['password'] = 'root';

    // Hidden databases in PhpMyAdmin left panel
    //$cfg['Servers'][$i]['hide_db'] = '(information_schema|mysql|performance_schema|sys)';
    // Allow connection without password
    $cfg['Servers'][$i]['AllowNoPassword'] = false;
}

// Suppress Warning about pmadb tables
$cfg['PmaNoRelation_DisableWarning'] = true;

// To have PRIMARY & INDEX in table structure export
$cfg['Export']['sql_drop_table'] = true;
$cfg['Export']['sql_if_not_exists'] = true;

$cfg['MySQLManualBase'] = 'http://dev.mysql.com/doc/refman/5.7/en/';
/* End of servers configuration */

?>

然后重新启动wamp的所有服务,并通过输入root作为用户名和root作为密码再次打开localhost,我得到此错误:

  

1045-用户'root'@'localhost'的访问被拒绝(使用密码:是)

我已经尝试了Internet上的所有解决方案,但是找不到任何可行的解决方案,因此我应该怎么做才能使它可行

0 个答案:

没有答案
相关问题