#1045 -用户“root”@“localhost”访问被拒绝(使用密码:YES)

时间:2021-12-03 20:11:17

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.

我无法使用mysql控制台登录到mysql。它要求输入密码,我不知道我输入了什么。(有办法获取或更改密码吗?)这是我的配置。公司看。

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

当我尝试打开phpmyadmin时,我得到了这个错误(#1045 -拒绝用户“root”@“localhost”的访问(使用密码: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.

我已经尝试卸载(加上删除所有相关文件)WAMP和重新安装。它并没有起到任何帮助。当重新安装WAMP服务器时,它不会要求任何用户名密码,我不知道为什么。非常感谢您的帮助。

19 个解决方案

#1


25  

I first changed the root password running mysql at a prompt with

我首先更改了运行mysql的根密码

mysql -u root -p

Update password:

更新密码:

UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';

Edited line in the file config.inc.php with the new root password:

在config.inc文件中编辑行。php的新根密码:

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

Stop and re-start mysql service (in Windows: mysql_stop.bat/mysql_start.bat)

停止并重新启动mysql服务(在Windows: mysql_stop.bat/mysql_start.bat中)

and got phpMyAdmin to work!

让phpMyAdmin运行!

EDIT 2017: for MySQL≥5.7 use authentication_string in place of Password (see this answer):

2017年编辑:MySQL≥5.7使用authentication_string代替密码(见这个答案):

UPDATE mysql.user SET authentication_string=PASSWORD('MyNewPass') WHERE User='root';

更新mysql。用户设置authentication_string=PASSWORD('MyNewPass'),其中user ='root';

#2


9  

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

问题是我安装了两个Mysql实例,我不知道两个实例的密码。只要检查端口80是否被任何程序使用。这就是我所做的

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

1。退出Skype是因为它使用的是80端口。(请检查其他程序是否使用端口80)。

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

2。在任务管理器中搜索Mysql服务并停止它。

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

3所示。现在删除所有相关的mysql文件。确保你删除了所有的文件。

4.Reinstall

4.重新安装

Hope this helps.

希望这个有帮助。

#3


4  

Well, there are many solutions already given above. If there are none of them works, maybe you should just try to reset your password again to 'root' as described here, and then reopen http://localhost/phpMyAdmin/ in other browser. At least this solution works for me.

上面已经给出了很多解。如果没有一个有效,那么您应该尝试重新将密码重置为“root”,然后在其他浏览器中重新打开http://localhost/phpMyAdmin/。至少这个解决方案对我来说是可行的。

#4


3  

  1. mysql -u root -p
  2. mysql - u root - p
  3. UPDATE mysql.user SET Password=PASSWORD('mypass') WHERE User='root';
  4. 更新mysql。用户设置密码=密码('mypass'),其中用户='root';
  5. Flush the privileges: FLUSH PRIVILEGES;
  6. 刷新特权:刷新特权;
  7. Exit by typing: Exit
  8. 出口通过输入:退出
  9. Edited line in the file config.inc.php with the new root password: $cfg['Servers'][$i]['password'] = 'mypass'

    在config.inc文件中编辑行。带新根密码的php: $cfg['Servers'][$i]['password'] = 'mypass'

  10. be succss

    是succss

#5


3  

Go to 'config.inc.php'. Write your password over here - $cfg['Servers'][$i]['password'] =''

去“config.inc.php”。在这里输入密码- $cfg['Servers'][$i]['password'] = "

#6


3  

Go to config.inc.php, find $cfg['Servers'][$i]['password'] and remove any password provided, i.e change $cfg['Servers'][$i]['password'] = 'password'; with $cfg['Servers'][$i]['password'] = '';

去config.inc。php,找到$cfg['Servers'][$i]['password'],并删除提供的任何密码。e更改$cfg['Servers'][$i]['password'] = 'password';cfg美元[“服务器”][我]美元[‘密码’]= ";

Now you can launch phpMyAdmin

现在可以启动phpMyAdmin了

Selecting Users menu from phpMyAdmin, select the root user and click Edit previlidges. Now scroll down to Change Password area, switch between No Password and Password to provide your new password. that's it.

从phpMyAdmin中选择Users菜单,选择根用户并单击Edit previlidges。现在向下滚动修改密码区域,在无密码和密码之间切换以提供新的密码。就是这样。

#7


2  

mysql.exe->Run as administrator or go to following path C:\wamp\bin\mysql\mysql5.5.24\bin and than right click on mysql.exe go to properties and than select tab as Compatibility and see the bottom of dialog box in privilege level and just check the Run this program as an administrator and then click apply ok.finished now you open success phpMyadmin. bye

mysql。>以管理员的身份运行,或转到以下路径C:\wamp\bin\mysql\ mysql5.24 \bin;exe转到properties和than选择tab作为兼容性,并在权限级别上看到对话框的底部,然后以管理员的身份检查运行这个程序,然后单击apply ok。现在完成了phpMyadmin。再见

#8


2  

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.

如果您在phpMyAdmin的用户概览页面中看到“root”用户的密码列字段“No”。

#9


2  

This process is quite simple in correcting the the error. What is happening is a failure to connect to phpMyAdmin. In order to fix the problem you simply need to provide the correct password to the system phpMyAdmin configuration file located in apps\phpMyadmin\config.ini.php 1. the root should already be set as user 2. Insert the password between ' ' and that it.

这个过程在纠正错误方面非常简单。发生的情况是没有连接到phpMyAdmin。为了解决这个问题,您只需为位于apps\ phpMyAdmin \config.ini中的系统phpMyAdmin配置文件提供正确的密码。php 1。应该已经将根设置为user 2。在“”和“”之间插入密码。

If you still have problems then this means that the user name and /or the password need to be updated or inserted into the DB. to do this use the command line tool and do an update.

如果您仍然有问题,那么这意味着需要更新用户名和/或密码或将其插入到DB中。为此,请使用命令行工具并进行更新。

UPDATE mysql.user SET Password=PASSWORD('Johnny59 or whatever you want to use') WHERE User='root';

更新mysql。用户设置密码=密码('Johnny59 or whatever you want to use'),其中用户='root';

#10


2  

after installation i started wamp and i was asked for user and pass which were already set on default (user:admin pass: dots), and that was wrong with a message from your topic. Than, i just entered:

在安装之后,我启动了wamp,我被要求输入用户和已经设置为默认值的pass(用户:admin pass: dots),这与您的主题的消息是错误的。比,我只是进入:

Username: root 
Password: (leave it empty)

and it worked for me!!

这对我很有效!!

#11


1  

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

我今天犯了同样的错误。我安装了Djangostack,当我检查任务管理器时,有两个mysqld运行的实例。我检查了一个是wamp服务器,另一个是django堆栈。我结束了django堆栈,重新启动了wamp服务器中的所有服务,并且能够访问phpmyadmin

#12


1  

with MariaDb, above solutions doesn't works.

对于MariaDb,上面的解决方案不起作用。

Use (exemple below with ubuntu 16.04 and mariadb-server Distrib 10.0.28):

使用(例如下面的ubuntu 16.04和mariadb-server Distrib 10.0.28):

    sudo mysql_secure_installation
    …
    Change the root password? [Y/n] 
    New password: 

#13


1  

I have encountered similar mistakes, and later found that my password is wrong.

我也遇到过类似的错误,后来发现我的密码是错误的。

#14


0  

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.

#15


0  

First you have to go config.inc.php file then change the following instruction

首先你要去config.inc。php文件然后更改以下指令

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

or

#1045 -用户“root”@“localhost”访问被拒绝(使用密码:YES)

#16


0  

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.

如果您到达这里是因为无法登录到phpMyAdmin,那么请尝试使用Mysql的根密码,而不是在phpMyAdmin安装期间输入的密码。

#17


0  

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

刚才我遇到了这种情况,我试过这种方法,非常简单。

First stop your mysql service using this command:

首先使用以下命令停止mysql服务:

service mysql stop

and then just again start your mysql service using this command

然后再用这个命令启动mysql服务

service mysql start

I hope it may help others... :)

我希望它能帮助别人……:)

#18


0  

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

在我的。C:\xampp\mysql\bin中的ini文件,在# mysql服务器下的[mysqld]命令后添加如下一行:

skip-grant-tables

This should remove the error 1045.

这将删除错误1045。

#19


0  

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';"

1)转到C:\xampp\phpMyAdmin 2)编辑config.inc。php文件3)取代" $ cfg[“服务器”][$ i][' auth_type ']=“配置”,“由”$ cfg[“服务器”][$ i][' auth_type ']=“饼干”;“

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

现在PHPMyAdmin会问你密码,没有错误。

#1


25  

I first changed the root password running mysql at a prompt with

我首先更改了运行mysql的根密码

mysql -u root -p

Update password:

更新密码:

UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';

Edited line in the file config.inc.php with the new root password:

在config.inc文件中编辑行。php的新根密码:

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

Stop and re-start mysql service (in Windows: mysql_stop.bat/mysql_start.bat)

停止并重新启动mysql服务(在Windows: mysql_stop.bat/mysql_start.bat中)

and got phpMyAdmin to work!

让phpMyAdmin运行!

EDIT 2017: for MySQL≥5.7 use authentication_string in place of Password (see this answer):

2017年编辑:MySQL≥5.7使用authentication_string代替密码(见这个答案):

UPDATE mysql.user SET authentication_string=PASSWORD('MyNewPass') WHERE User='root';

更新mysql。用户设置authentication_string=PASSWORD('MyNewPass'),其中user ='root';

#2


9  

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

问题是我安装了两个Mysql实例,我不知道两个实例的密码。只要检查端口80是否被任何程序使用。这就是我所做的

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

1。退出Skype是因为它使用的是80端口。(请检查其他程序是否使用端口80)。

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

2。在任务管理器中搜索Mysql服务并停止它。

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

3所示。现在删除所有相关的mysql文件。确保你删除了所有的文件。

4.Reinstall

4.重新安装

Hope this helps.

希望这个有帮助。

#3


4  

Well, there are many solutions already given above. If there are none of them works, maybe you should just try to reset your password again to 'root' as described here, and then reopen http://localhost/phpMyAdmin/ in other browser. At least this solution works for me.

上面已经给出了很多解。如果没有一个有效,那么您应该尝试重新将密码重置为“root”,然后在其他浏览器中重新打开http://localhost/phpMyAdmin/。至少这个解决方案对我来说是可行的。

#4


3  

  1. mysql -u root -p
  2. mysql - u root - p
  3. UPDATE mysql.user SET Password=PASSWORD('mypass') WHERE User='root';
  4. 更新mysql。用户设置密码=密码('mypass'),其中用户='root';
  5. Flush the privileges: FLUSH PRIVILEGES;
  6. 刷新特权:刷新特权;
  7. Exit by typing: Exit
  8. 出口通过输入:退出
  9. Edited line in the file config.inc.php with the new root password: $cfg['Servers'][$i]['password'] = 'mypass'

    在config.inc文件中编辑行。带新根密码的php: $cfg['Servers'][$i]['password'] = 'mypass'

  10. be succss

    是succss

#5


3  

Go to 'config.inc.php'. Write your password over here - $cfg['Servers'][$i]['password'] =''

去“config.inc.php”。在这里输入密码- $cfg['Servers'][$i]['password'] = "

#6


3  

Go to config.inc.php, find $cfg['Servers'][$i]['password'] and remove any password provided, i.e change $cfg['Servers'][$i]['password'] = 'password'; with $cfg['Servers'][$i]['password'] = '';

去config.inc。php,找到$cfg['Servers'][$i]['password'],并删除提供的任何密码。e更改$cfg['Servers'][$i]['password'] = 'password';cfg美元[“服务器”][我]美元[‘密码’]= ";

Now you can launch phpMyAdmin

现在可以启动phpMyAdmin了

Selecting Users menu from phpMyAdmin, select the root user and click Edit previlidges. Now scroll down to Change Password area, switch between No Password and Password to provide your new password. that's it.

从phpMyAdmin中选择Users菜单,选择根用户并单击Edit previlidges。现在向下滚动修改密码区域,在无密码和密码之间切换以提供新的密码。就是这样。

#7


2  

mysql.exe->Run as administrator or go to following path C:\wamp\bin\mysql\mysql5.5.24\bin and than right click on mysql.exe go to properties and than select tab as Compatibility and see the bottom of dialog box in privilege level and just check the Run this program as an administrator and then click apply ok.finished now you open success phpMyadmin. bye

mysql。>以管理员的身份运行,或转到以下路径C:\wamp\bin\mysql\ mysql5.24 \bin;exe转到properties和than选择tab作为兼容性,并在权限级别上看到对话框的底部,然后以管理员的身份检查运行这个程序,然后单击apply ok。现在完成了phpMyadmin。再见

#8


2  

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.

如果您在phpMyAdmin的用户概览页面中看到“root”用户的密码列字段“No”。

#9


2  

This process is quite simple in correcting the the error. What is happening is a failure to connect to phpMyAdmin. In order to fix the problem you simply need to provide the correct password to the system phpMyAdmin configuration file located in apps\phpMyadmin\config.ini.php 1. the root should already be set as user 2. Insert the password between ' ' and that it.

这个过程在纠正错误方面非常简单。发生的情况是没有连接到phpMyAdmin。为了解决这个问题,您只需为位于apps\ phpMyAdmin \config.ini中的系统phpMyAdmin配置文件提供正确的密码。php 1。应该已经将根设置为user 2。在“”和“”之间插入密码。

If you still have problems then this means that the user name and /or the password need to be updated or inserted into the DB. to do this use the command line tool and do an update.

如果您仍然有问题,那么这意味着需要更新用户名和/或密码或将其插入到DB中。为此,请使用命令行工具并进行更新。

UPDATE mysql.user SET Password=PASSWORD('Johnny59 or whatever you want to use') WHERE User='root';

更新mysql。用户设置密码=密码('Johnny59 or whatever you want to use'),其中用户='root';

#10


2  

after installation i started wamp and i was asked for user and pass which were already set on default (user:admin pass: dots), and that was wrong with a message from your topic. Than, i just entered:

在安装之后,我启动了wamp,我被要求输入用户和已经设置为默认值的pass(用户:admin pass: dots),这与您的主题的消息是错误的。比,我只是进入:

Username: root 
Password: (leave it empty)

and it worked for me!!

这对我很有效!!

#11


1  

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

我今天犯了同样的错误。我安装了Djangostack,当我检查任务管理器时,有两个mysqld运行的实例。我检查了一个是wamp服务器,另一个是django堆栈。我结束了django堆栈,重新启动了wamp服务器中的所有服务,并且能够访问phpmyadmin

#12


1  

with MariaDb, above solutions doesn't works.

对于MariaDb,上面的解决方案不起作用。

Use (exemple below with ubuntu 16.04 and mariadb-server Distrib 10.0.28):

使用(例如下面的ubuntu 16.04和mariadb-server Distrib 10.0.28):

    sudo mysql_secure_installation
    …
    Change the root password? [Y/n] 
    New password: 

#13


1  

I have encountered similar mistakes, and later found that my password is wrong.

我也遇到过类似的错误,后来发现我的密码是错误的。

#14


0  

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.

#15


0  

First you have to go config.inc.php file then change the following instruction

首先你要去config.inc。php文件然后更改以下指令

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

or

#1045 -用户“root”@“localhost”访问被拒绝(使用密码:YES)

#16


0  

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.

如果您到达这里是因为无法登录到phpMyAdmin,那么请尝试使用Mysql的根密码,而不是在phpMyAdmin安装期间输入的密码。

#17


0  

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

刚才我遇到了这种情况,我试过这种方法,非常简单。

First stop your mysql service using this command:

首先使用以下命令停止mysql服务:

service mysql stop

and then just again start your mysql service using this command

然后再用这个命令启动mysql服务

service mysql start

I hope it may help others... :)

我希望它能帮助别人……:)

#18


0  

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

在我的。C:\xampp\mysql\bin中的ini文件,在# mysql服务器下的[mysqld]命令后添加如下一行:

skip-grant-tables

This should remove the error 1045.

这将删除错误1045。

#19


0  

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';"

1)转到C:\xampp\phpMyAdmin 2)编辑config.inc。php文件3)取代" $ cfg[“服务器”][$ i][' auth_type ']=“配置”,“由”$ cfg[“服务器”][$ i][' auth_type ']=“饼干”;“

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

现在PHPMyAdmin会问你密码,没有错误。