There is no password in MySQL 5.7, and it has been changed to authentication_ string
update mysql.user set authentication_string=password('root') where user='root' ;
The complete way to change MySQL password is as follows:
1.vim /etc/my.cnf [mysqld] add skip-grant-tables
2./etc/init.d/mysqld restart
3.Type mysql in the terminal to log in directly to the MySQL database, and then use mysql
4.update mysql.user set authentication_string=password('root') where user='root' ;
5.flush privileges;
6.quit;
7.Edit /etc/my.cnf to remove skip-grant-tables, then restart MySQL /etc/init.d/mysqld restart
8. mysql -u root -p and enter the password to log in to the MySQL database
In the old version, the command to change the password is as follows: mysql5.7 password is changed to authentication_ string
mysql> update user set password=password(“new password”) where user=”username”;