gpt4 book ai didi

mysql - Vagrant 无法登录 MySQL

转载 作者:行者123 更新时间:2023-11-29 12:21:59 24 4
gpt4 key购买 nike

背景:我使用的是 Windows 7 主机,带有 Virtual Box 和 Vagrant。我安装了 Ubuntu guest - ubuntu/precise64,然后安装了 Apache、MySQL 和 PHP。我设置了 MySQL 密码,并运行了 mysql_secure_installation。我的问题是这样的:当我通过 SSH 登录到我的服务器(以 root 身份)时,我似乎无法连接到 MySQL。运行mysql -u root -p然后输入我的 MySQL 密码会收到此通知:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

另一方面,如果我这样做:mysql -u root --password=*my-mysql-root-password*我进去了。为什么会发生这种情况?

最佳答案

所以,我终于找到了答案。问题是我的 mysql root 密码超过 8 个字符。将密码更改为少于 8 个字符即可解决问题。根据http://dev.mysql.com/doc/refman/5.0/en/connecting.html :

On some systems, the library routine that MySQL uses to prompt for a password automatically limits the password to eight characters. That is a problem with the system library, not with MySQL. Internally, MySQL does not have any limit for the length of the password. To work around the problem, change your MySQL password to a value that is eight or fewer characters long, or put your password in an option file.

关于mysql - Vagrant 无法登录 MySQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28870608/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com