用户'root @ localhost'的访问被拒绝(使用密码:NO) [英] Access denied for user 'root@localhost' (using password:NO)

查看:486
本文介绍了用户'root @ localhost'的访问被拒绝(使用密码:NO)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是MySQL的新手,我试图在Windows桌面上运行WordPress,并且它需要MySQL.

I'm new to MySQL, I'm trying to run WordPress in my Windows desktop and it needs MySQL.

我使用Microsoft提供的Web Platform Installer安装所有程序.我从来没有为MySQL设置过root密码,在安装WordPress的最后一步中,它要求输入MySQL服务器密码.

I install everything with Web Platform Installer which is provided by Microsoft. I never set a root password for MySQL and in the final step of installing WordPress, it asks for a MySQL server password.

root的默认密码是多少(如果有的话)以及如何更改密码?

What is the default password for root (if there is one) and how to change it?

我尝试过:

mysql -u root password '123'

但这显示了我

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

在此之后,我尝试:

mysql -u root -p

但是,它要求输入我没有的密码.

However, it asks for a password which I don't have.

更新:按照博佐的建议,我做了以下操作:

Update: as Bozho suggested, I did the following:

  1. 我从Windows服务中停止了MySQL服务
  2. 打开CMD
  3. 将位置更改为c:\ program files \ mysql \ bin
  4. 执行了以下命令

  1. I stopped the MySQL Service from Windows services
  2. Opened CMD
  3. Changed the location to c:\program files\mysql\bin
  4. Executed the command below

mysqld --defaults-file="C:\\program files\\mysql\\mysql server 5.1\\my.ini" --init-files=C:\\root.txt

该命令运行时出现了有关我下面提到的字符集的警告

The command ran with a warning about character set which I mentioned below

我在命令行中写

mysql -u root -p EnterPassword: 123 // 123 was the password

命令行显示以下错误

Access denied for user 'root@localhost' (using password:**YES**)

我该如何解决?我正在等待您的来信.

How do I solve this? I'm waiting to hear from you.

推荐答案

您可以

You can reset your root password. Have in mind that it is not advisable to use root without password.

这篇关于用户'root @ localhost'的访问被拒绝(使用密码:NO)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆