#1045 - Access denied for user 'root'@'

2020-01-26 06:21发布

This might seem redundant but I was unable to find a correct solution.

I was unable to login to mysql using the mysql console.It is asking for a password and I have no clue what I actually entered.(Is there a way to get the password or change it?) This is how my config.inc look.

When I try to open phpmyadmin I get this error(#1045 - Access denied for user 'root'@'localhost' (using password: YES))

<?php

/* Servers configuration */
$i = 0;

/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['socket'] = '';
$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'] = 'prakash123';
$cfg['Servers'][$i]['AllowNoPassword'] = true;

/* End of servers configuration */

$cfg['DefaultLang'] = 'en-utf-8';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';


/* rajk - for blobstreaming */
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';


?>

I have tried to uninstall( Plus Deleted all the related files) WAMP and reinstall.It didn't help either. While reinstalling WAMP server it is not asking for any username password stuff I don't know why. Any help is highly appreciated.

22条回答
仙女界的扛把子
2楼-- · 2020-01-26 06:51

After I updated my MySql, I was getting the same error message. It turned out that after installing a different version on MySql, inside the my.ini, the port was different. Previous MySql version had port 3306 but the new one have port 3308. Check your MySql my.ini, if it is different use the port from .ini in your connection.

查看更多
Fickle 薄情
3楼-- · 2020-01-26 06:51

if multiple myslq running on same port no enter image description here

Right click on wamp and test port 3306 if its wampmysqld64 its correct else change port no and restart server

查看更多
劳资没心,怎么记你
4楼-- · 2020-01-26 06:54

Try the following code:

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

if you see Password column field as 'No' for the 'root' user in Users Overview page of phpMyAdmin.

查看更多
Melony?
5楼-- · 2020-01-26 06:54

In the my.ini file in C:\xampp\mysql\bin, add the following line after the [mysqld] command under #Mysql Server:

skip-grant-tables

This should remove the error 1045.

查看更多
一夜七次
6楼-- · 2020-01-26 06:56

The problem was I have 2 instances of Mysql installed and I didn't know the password for both instances.Just check if port 80 is used by any of the programs. This is what I did

1.Quit Skype because it was using port 80.(Please check if port 80 is used by any other program).

2.Search for Mysql services in task manager and stop it.

3.Now delete all the related mysql files.Make sure you delete all the files.

4.Reinstall

查看更多
看我几分像从前
7楼-- · 2020-01-26 07:01
  1. Go to C:\xampp\phpMyAdmin

  2. Edit the config.inc.php file

  3. Replace $cfg['Servers'][$i]['auth_type'] = 'config'; by $cfg['Servers'][$i]['auth_type'] = 'cookie';

For now on the PHPMyAdmin will ask you for your password, no more error.

查看更多
登录 后发表回答