错误 1045 (28000) 用户“root”@“localhost”访问被拒绝(使用密码:YES)
请原谅我是一个完全的初学者:
我正在尝试使用 cmd 行登录到我在 Windows 计算机上使用 easyPHP 安装的第一个 mySQL 数据库。我要去 \mysql\bin 并输入命令:
mysql -u root
为了登录,但我收到以下消息:
error 1045 (28000) access denied for user 'root'@'localhost' (using password: YES)
为什么它使用密码“YES”?根本不应该有密码吗?我需要重启mySQL什么的吗?如果是这样,我该怎么做?如果相关的话,我确实尝试使用 phpmyadmin 创建数据库,但在输入列时遇到了一些问题,并决定最好从命令行工作,这样我就可以学习所有命令。
请记住,这是我第一次尝试使用数据库,所以请善待我!
Please forgive me for being a complete beginner:
I am trying to log into my very first mySQL database that I installed using easyPHP on my windows machine, using the cmd line. I am going to the \mysql\bin and entering the command:
mysql -u root
in order to log in, but I am getting the following message:
error 1045 (28000) access denied for user 'root'@'localhost' (using password: YES)
Why is it using the password "YES"? Shouldn't there be no password at all? Do I need to restart mySQL or something? If so, how do I do that? If it's relevant, I did try to create the database using phpmyadmin, but had a few problems entering columns and decided I'd be better off working from the command line so I could learn all the commands as I went along.
Please keep in mind that this is my first time ever trying to work with a database, so be kind to me!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
要让 mysql 要求您输入密码,您还需要指定
-p
-选项:To have mysql asking you for a password, you also need to specify the
-p
-option:使用命令行登录 MYSQL 时,还必须指定密码(如果有)。您的错误消息告诉您用户“root”附加了密码。当您安装 easyPHP 时,密码不一定是“YES”,它应该为您提供默认密码或允许您输入您选择的密码。
根据easyPHP的文档:
mysql -u root -p
现在,如果您更改了 root 用户密码,则需要在出现提示时指定。否则,只需按键盘上的
即可。如果您忘记了 root 密码并已更改,则随后必须重新安装 easyPHP。
When logging into MYSQL using the command line, you also have to specify the password if any. Your error message is telling you that the user "root" has a password attached to it. Not necessarily that the password is "YES" when you were installing easyPHP, it should have either provided you with a default password or allowed you to enter a password of your choosing.
According to the documentation of easyPHP:
mysql -u root -p
Now if you changed your root user password, you will need to specify that when prompted. Otherwise simply hit
<Enter>
on your keyboard.If you FORGOT the password to root, and have changed it, you will have to subsequently reinstall easyPHP.
mac 上 mysql- 5.7.10 的修改 mac el Capitan
sudo mysqld_safe --skip-grant-tables
现在在终端上打开新窗口/选项卡并输入
A modification for mysql- 5.7.10 on mac mac el capitan
sudo mysqld_safe --skip-grant-tables
Now open new window/tab on terminal and type