Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql Password Expired , Using Homestead Virtualbox

I keep getting this message on my larval application

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.

I've tried reseting password like so :

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

i get a response

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

but when still get error in my view, I tried connecting to db using sequel pro, and got the same error

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

not sure what else i can do, I tried vagrant provision after the reset, and still get same error

like image 290
Luna Avatar asked Nov 16 '25 15:11

Luna


1 Answers

I have the same problem. I have solved it modifying homestead files. In 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";

This is the line that gives me the problem. Before this line i reset the password with --connect-expired-password option. I have to reset the laravel bd user password too. Supposing that laravel bd user is root and password is secret:

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";

Works for me.

like image 105
Aferro Avatar answered Nov 19 '25 08:11

Aferro



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!