Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LARAVEL HOMESTEAD SQLSTATE[HY000] [1862] Your password has expired. To log in you must change it using a client that supports expired passwords

Tags:

php

mysql

I have gotten stuck all day with an expired password for mysql. I have followed other similar questions yet I continue to get the same password expired error. I have uninstalled and reenstalled Mysql with homebrew. I have restarted the mysql server. I have deleted,changed and created homestead users in mysql and even uninstalled then reinstalledenter image description here homestead and vagrant.None of this is working. What should I do?

enter image description here

enter image description here

Edit-Update:

I can make it into the mysql with the following using sequel pro:

enter image description here

but having this in the .env file reproduces the expired password error.:

enter image description here

enter image description here

like image 270
Ricki Moore Avatar asked Dec 19 '22 12:12

Ricki Moore


1 Answers

What I've done for now is to set the password again.

  1. vagrant ssh
  2. mysql -u homestead -p
  3. Type in the existing password (secret)
  4. SET password=PASSWORD("secret");

This has started happening on all my vagrant boxes, some that haven't even been provisioned lately which means wildly different MySQL versions, typically 5.6+ at least. It's not a long term fix either sadly. These steps will have to be repeated until someone can track down how to fix it for good.

Edit: I'm using Homestead v2 with a tweak to use this box: https://atlas.hashicorp.com/laravel/boxes/homestead/versions/0.3.3. They're all the same MySQL version which explains why I'm seeing this across the board.

The current version of MySQL for that box is 5.7.9 and the password expiration policy has the default default_password_lifetime at 360. The password in that box has a password_last_changed time of 2015-11-13 03:50:18. 360 days after that is 2016-11-07 03:50:18 which I believe precisely explains why this occurred in the first place.

I checked all of the possible MySQL config locations and I see nothing overriding this default. I believe setting it to 0 or altering the user to never expire (after the set password command) should be enough to fix it for good, I hope.

like image 170
w0rd-driven Avatar answered Apr 08 '23 04:04

w0rd-driven