I just wiped my Mac and did a fresh install of El Capitan. I\'m struggling to connect to Mysql now. Having gone through a web server setup process, I\'ve created a simple PH
So I finally found the solution myself.
Firstly I went into terminal and typed:
mysql -u root -p
This asked for my current password which I typed in and it gave me access to provide more mysql commands. Anything I tried from here gave this error:
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
This is confusing because I couldn't actually see a way of resetting the password using ALTER USER
statement, but I did find another simple solution:
SET PASSWORD = PASSWORD('xxxxxxxx');
The password expiration is a new feature in MySQL 5.6 or 5.7.
The answer is clear: Use a client which is capable of expired password changing (I think Sequel Pro can do it).
MySQLi library obviously isnt able to change the expired password.
If you have limited access to localhost and you only have a console client, the standard mysql client can do it.
best easy solution:
[PATH MYSQL]/bin/mysql -u root
[Enter password]
SET GLOBAL default_password_lifetime = 0;
and then works fine.
On Windows in phpmyadmin look in Variables: default_password_lifetime, and switch it to 0 (instead of 360), enjoy.
Its possible than mySQL take again 360 days, so add in my.ini :
[mysqld]
default_password_lifetime=0
And restart mysql.
All of these answers are using Linux consoles to access MySQL.
If you are on Windows and are using WAMP, you can start by opening the MySQL console (click WAMP icon->MySQL->MySQL console
).
Then it will request you to enter your current password, enter it.
And then type SET PASSWORD = PASSWORD('some_pass');
i have faced this issue few days ago. For best solution for 5.7 version of MySQL; login your mysql console and alter your password with the following command:
ALTER USER `root`@`localhost` IDENTIFIED BY 'new_password', `root`@`localhost` PASSWORD EXPIRE NEVER;