MySQL在Windows上通过命令行拒绝有效密码[关闭](MySQL rejects valid password via Command line on Windows [closed])

系统教程 行业动态 更新时间:2024-06-14 17:01:31
MySQL在Windows上通过命令行拒绝有效密码[关闭](MySQL rejects valid password via Command line on Windows [closed])

在mysql.user表中成功创建新用户'u1'和'u2'并将其密码分别设置为pass和PASSWORD('pass') ,我无法以任一用户身份登录。 请查看以下命令,帮助我弄清楚我错过了什么。 请注意,每个隐藏密码只是字符串“pass” 为什么拒绝访问? 请注意,当我创建用户u1和u2时,我是root用户(具有所有权限)

After successfully creating new users 'u1' and 'u2' in mysql.user table and setting their passwords to pass and PASSWORD('pass') respectively, I am unable to log in as either user. Please review the commands below and help me figure out what I'm missing. Note that each concealed password is just the string "pass" Why is access denied? Note that I was the root user (with all privileges) when I created the users u1 and u2

最满意答案

CREATE USER 'u3'@'localhost' IDENTIFIED BY 'pass'; CREATE USER 'u4'@'localhost' IDENTIFIED BY 'pass';

来自OP的一个好问题提示:上面创建的两个用户基本上没有服务器的权限 ,除了登录和坐在那里。 他们正在等待Grant命令,允许他们对某些数据库拥有各种访问权限。

然后试试吧。 创建create user命令是有原因的。

之后,您将处理特定数据库的授权。 并重新审视主持人问题。

但这只是一个考验。

然后从o / s命令行登录,它是mysql -uu3 -p和ENTER。 然后会提示您输入密码。 除非您知道自己正在进行维护,否则强烈建议不要以root用户身份登录。 此外,不要将密码烘焙到脚本文件中,例如mysql -uu3 -ppass因为您的文件可能mysql -uu3 -ppass ,而您的密码也是如此。 注意,在我的示例中,-u和-p之后没有空格。

是的,使用-p开关,当系统提示您输入密码时,它可见。

从手册创建用户命令。

从手册中删除用户命令。

手册中的授予命令。 请注意不要在Grant命令中使用通配符和WITH GRANT OPTION 。 您需要小心地为他们所需的用户授予最小权限,而不是懒惰和应用通配符。

CREATE USER 'u3'@'localhost' IDENTIFIED BY 'pass'; CREATE USER 'u4'@'localhost' IDENTIFIED BY 'pass';

A good question from the OP prompted this: The two users just created above have basically no privileges to the server yet, except to login and sit there. They are awaiting the Grant command to allow them various access rights to certain databases.

Then try them. There is a reason the create user command was created.

After that you deal with grants to particular databases. And revisit the host issue.

But this is just a test.

Then to login from o/s command line, it is mysql -uu3 -p and ENTER. You will then be prompted for password. It is highly recommended not to login as root unless you know you are doing maintenance. Also, do not bake the password into a script file such as mysql -uu3 -ppass as your file could be poached and your password too. Note, no space after -u and -p in my example.

And yes, with the -p switch, when you are prompted for password, it is not visible.

Create User command from the Manual.

Drop User command from the Manual.

Grant command from the Manual. Be very careful not to use wildcards and WITH GRANT OPTION with the Grant command. You need to be careful to grant the minimal rights for users necessary for them, versus being lazy and applying wildcards.

更多推荐

本文发布于:2023-04-20 16:11:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/7b0ecc863e063f47cdfd659452565203.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:命令行   密码   rejects   Windows   MySQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!