MySQL 密码不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2214843/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 15:12:38  来源:igfitidea点击:

MySQL Password Not Working

mysqlpasswords

提问by Anthony

EDIT: I had MySQL installed twice on my machine (XAMPP & on its own)

编辑:我在我的机器上安装了两次 MySQL(XAMPP 和它自己)

When I enter my password into MySQL Command Line Client, it rejects my password, gives 1 beep and closes the window. Can anyone provide me with a basic troubleshooting list of steps (from simple to progressively more technical) to regain entry into MySQL once and for all. Also, can anyone tell me what can cause my password to suddenly be rejected? I am also running XAMPP and the MySQL service is both installed and running. Thanks in advance.

当我将密码输入 MySQL 命令行客户端时,它拒绝我的密码,发出 1 声哔声并关闭窗口。任何人都可以向我提供基本的故障排除步骤列表(从简单到逐渐增加技术性),以一劳永逸地重新进入 MySQL。另外,谁能告诉我什么会导致我的密码突然被拒绝?我也在运行 XAMPP,并且 MySQL 服务已安装并正在运行。提前致谢。

I remember when I first got this problem some months ago, if I recall correctly, I solved it by starting the MySQL service from Windows XP's Administrative Tool (something I did stopped the MySQL service and to this day I don't know what it was).

我记得几个月前我第一次遇到这个问题时,如果我没记错的话,我通过从 Windows XP 的管理工具启动 MySQL 服务来解决它(我确实停止了 MySQL 服务,直到今天我不知道它是什么)。

Now the problem has started back again but this time, when I checked Services, the MySQL service was already 'started'.

现在问题又开始了,但是这一次,当我检查服务时,MySQL 服务已经“启动”了。

Any assistance will be appreciated. Thanks

任何帮助将不胜感激。谢谢

回答by Anthony

I think I figured out why my password was not working. I had two versions of MySQL installed on my machine (XAMPP and MySQL 5.1). So I deleted the MySQL 5.1 and it worked.

我想我知道为什么我的密码不起作用了。我的机器上安装了两个版本的 MySQL(XAMPP 和 MySQL 5.1)。所以我删除了 MySQL 5.1 并且它起作用了。

回答by James

Do you have the password for the root account? If so Try this from the command line?

你有root账户的密码吗?如果是这样从命令行试试这个?

    mysql --user=root --password=your password here
    -- or --
    mysql --user=root --password=your password here --database=MySQL

回答by inteblio

For me (and my similar problem)
--password=mypass
didn't work
but
--password="mypass"
did

对于我(和我类似的问题)
--password =为mypass
没有工作,

--password =“为mypass”

回答by Eli

Is there an error message when it rejects your password? I wonder if perhaps you are using an outdated client and running into this issue: http://dev.mysql.com/doc/refman/5.1/en/old-client.html

拒绝您的密码时是否有错误消息?我想知道您是否使用过时的客户端并遇到此问题:http: //dev.mysql.com/doc/refman/5.1/en/old-client.html

回答by Sxit

http://dev.mysql.com/doc/refman/5.0/en//resetting-permissions.html

http://dev.mysql.com/doc/refman/5.0/en//resetting-permissions.html

This is the services solution that was mentioned. Use this if you can't remember your root password.

这就是提到的服务解决方案。如果您不记得您的 root 密码,请使用此选项。

回答by Anton Smith

A bit too late but - If you have numeric characters in your password and are using the numpad on your keyboard, ensure that the numlock is ON. For some weird reason if you have numlock off MySQL will still interpret a keystroke. This wasn't very obvious to me since my laptop doesn't have a num lock indicator light, thats HP for yah :)

有点晚了但是 - 如果您的密码中有数字字符并且正在使用键盘上的数字键盘,请确保数字锁定已打开。出于某种奇怪的原因,如果您关闭了 numlock,MySQL 仍会解释击键。这对我来说不是很明显,因为我的笔记本电脑没有 num lock 指示灯,这就是惠普的 yah :)

回答by austinthemassive

If you set mySQL to notbegin running on startup, then you need to start it prior to attempting to login. This can be done via the command line, via the task manager if you configured it as a windows service, etc.

如果您将 mySQL 设置为在启动时开始运行,那么您需要在尝试登录之前启动它。这可以通过命令行完成,如果您将其配置为 Windows 服务,则可以通过任务管理器等完成。

For example, here is an explanation of starting the service using cmd

比如这里有使用cmd启动服务的说明

http://dev.mysql.com/doc/refman/5.7/en/windows-start-command-line.html

http://dev.mysql.com/doc/refman/5.7/en/windows-start-command-line.html

回答by Anthony

My password suddenly worked again so I took the following steps to change it:

我的密码突然又起作用了,所以我采取了以下步骤来更改它:

  1. Using Windows Command Prompt, navigate to MySQL's bin directory
  2. Type: mysqladmin -uroot -p password yourNewPassword
  3. Press enter. You will be prompted for your password, enter it
  4. If no error messages/beeps happen, your password was successfully changed
  5. Log in using MySQL Command Prompt with your new password
  1. 使用 Windows 命令提示符,导航到 MySQL 的 bin 目录
  2. 输入:mysqladmin -uroot -p 密码 yourNewPassword
  3. 按回车键。系统将提示您输入密码,请输入
  4. 如果没有错误消息/哔声发生,您的密码已成功更改
  5. 使用 MySQL 命令提示符和您的新密码登录

What I don't understand is, WHY all of a sudden my password started back to work after approximately 24 hours? I wish I know so I can avoid this in the future.

我不明白的是,为什么我的密码在大约 24 小时后突然开始恢复工作?我希望我知道,这样我将来就可以避免这种情况。

回答by Dale

I'd like to add another successful solution to this problem. I reran the installer (the msi), chose the repair option and everything was fixed.

我想为这个问题添加另一个成功的解决方案。我重新运行安装程序(msi),选择了修复选项,一切都修复了。