#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 07:01

For UNIX, try this. It worked for me:

  1. connect MySQL use Navicat Premium with inital root/"password"
  2. UPDATE mysql.user SET authentication_string = PASSWORD('MyNewPass'), password_expired = 'N' WHERE User = 'root' AND Host = 'localhost'; FLUSH PRIVILEGES;
  3. restart MySQL
查看更多
Evening l夕情丶
3楼-- · 2020-01-26 07:02

If you arrived here because you can't log into your phpMyAdmin, then try the root password from your Mysql instead of the password you put during phpMyAdmin installation.

查看更多
\"骚年 ilove
4楼-- · 2020-01-26 07:02

Just now I have this situation and I have tried this way which is very easy.

First stop your mysql service using this command:

service mysql stop

and then just again start your mysql service using this command

service mysql start

I hope it may help others... :)

查看更多
够拽才男人
5楼-- · 2020-01-26 07:03

I had the same error today. I had installed Djangostack and when I checked my task manager there were two instances of mysqld running. I checked one was for wamp server and the other was for django stack. I ended the one for django stack, restarted all services in wamp server and I was able to access phpmyadmin

查看更多
登录 后发表回答