Version update, the original password field in user has been changed to authentication_string
Version update, many online tutorials are not applicable, even the official website of the document is not able to operate smoothly.
If MySQL is running, first kill it:
Killall-term mysqld.
Run
Mysqld_safe--skip-grant-tables &
If you do not want to be remotely connected at this time: Mysqld_safe--skip-grant-tables--skip-networking &
Using MySQL to connect to server
Change Password:
Update Mysql.user set Authentication_string=password (' 123qwe ') where user= ' root ' and Host = ' localhost ';
* Note that there is no password field in the user table in the new MySQL database.
Instead, the encrypted user password is stored in the Authentication_string field
mysql> Flush privileges;mysql> quit;
The modification is complete. Restart
Killall-term mysqld. Mysqld_safe &
And then MySQL can connect.
But at this point the operation seems to be incomplete, but also alter user ...
Alter user ' root ' @ ' localhost ' identified by ' 123 ';
The web says Jiangzi can also:
Set password for ' root ' @ ' localhost ' =password (' 123 '); CP Mysql.server/etc/init.d/mysqlchmod +x/etc/init.d/ Mysqlchkconfig--add MySQL
16/7/14-mysql-Modify mysql5.6 or later root password