Error: Unable to connect to MySQL.
Debugging errno: 1862
Debugging error: Your password has expired. To log in you must change it using a client that supports expired passwords.
Open your MySQL Command Line Control SET GLOBAL default_password_lifetime = 0;

ALTER USER 'usrname'@'localhost' IDENTIFIED BY 'new-password';
To expire any user account
ALTER USER 'user_id'@'localhost' PASSWORD EXPIRE;
Not to expire any user password
ALTER USER 'my_userid'@'localhost' PASSWORD EXPIRE NEVER
To set the password duration for all the users ( global ) , 60 days
SET GLOBAL default_password_lifetime = 60;
For a user to set a different days than the global set value
ALTER USER 'userid'@'localhost' PASSWORD EXPIRE INTERVAL 30 DAY;
In all these cases MySQL keeps the user in Sandbox Mode , that is the user is allowed for changing the password only.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.