Mysql密码已过期,使用Homestead Virtualbox

时间:2016-11-07 23:15:59

标签: mysql homestead

我一直在我的幼虫应用程序上收到此消息

PDOException in Connector.php line 119:
SQLSTATE[HY000] [1862] Your password has expired. To log in you must change it using a client that supports expired passwords.

我尝试过重置密码:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('secret');

我收到回复

Query OK, 0 rows affected, 1 warning (0.00 sec)

但是当我的视图中仍然出现错误时,我尝试使用sequel pro连接到db,并得到了同样的错误

MySQL said: Your password has expired. To log in you must change it using a client that supports expired passwords.

不确定我还能做什么,我在重置后尝试了流浪汉提供,但仍然得到同样的错误

1 个答案:

答案 0 :(得分:1)

我有同样的问题。我已经解决了修改宅基地文件的问题。 在vendor / laravel / homestead / scripts / create-mysql.sh

mysql -uhomestead -psecret -e "CREATE DATABASE IF NOT EXISTS \`$DB\` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci";

这是给我问题的线。在此行之前,我使用--connect-expired-password选项重置密码。我也必须重置laravel bd用户密码。假设laravel bd用户是root用户并且密码是秘密的:

mysql -uhomestead -psecret -e "SET PASSWORD  = PASSWORD('secret')" --connect-expired-password;
mysql -uroot -psecret -e "SET PASSWORD  = PASSWORD('secret')" --connect-expired-password;
mysql -uhomestead -psecret -e "CREATE DATABASE IF NOT EXISTS \`$DB\` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci";

适合我。