MySQL command line password change, mysql password change
To assign a password when creating a new account, use create user and includeIDENTIFIED BY
Clause
CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';
To assign or change a password to an existing account, use one of the following methods:
1) Use the statement with the identified by clause of alter user:
ALTER USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';
If you are not connected as an anonymous user, you can change your password without directly naming your account:
ALTER USER USER() IDENTIFIED BY 'mypass';
2) To change the account password from the command line, use the mysqladmin command:
mysqladmin -u user_name -h host_name password "new_password"
Lightning reference https://dev.mysql.com/doc/refman/5.6/en/alter-user.html
---------------------------------------------------------------------------------
After installing mysql, modify it for the first time.
Step 1:
Set password = PASSWORD ('your new password ');
Step 2:
Alter user 'root' @ 'localhost' password expire never;
Step 3:
Flush privileges;
After completing the three steps above, log on again and use the new password. In addition to changing the new password in red, enter the new password as is.
This method seems better. → Conversion