开发者

How to remove MySQL root password [closed]

开发者 https://www.devze.com 2023-01-03 12:38 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. 开发者_运维技巧 Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers.
开发者_运维技巧

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 9 years ago.

Improve this question

I want to remove the password for user root in localhost. How can I do that? By mistake I have set the password of root user. That's why phpmyadmin is giving an error:

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


You need to set the password for root@localhost to be blank. There are two ways:

  1. The MySQL SET PASSWORD command:

    SET PASSWORD FOR root@localhost=PASSWORD(''); -- MySQL 5.x
    SET PASSWORD FOR root@localhost=''; -- MySQL 8.x
    
  2. Using the command-line mysqladmin tool:

    mysqladmin -u root -pType_in_your_current_password_here password ''
    


I have also been through this problem,

First i tried setting my password of root to blank using command :

SET PASSWORD FOR root@localhost=PASSWORD('');

But don't be happy , PHPMYADMIN uses 127.0.0.1 not localhost , i know you would say both are same but that is not the case , use the command mentioned underneath and you are done.

SET PASSWORD FOR root@127.0.0.1=PASSWORD('');

Just replace localhost with 127.0.0.1 and you are done .

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号