Mysql5.7 how to change the root password, mysql5.7 how to change the root password
Version update. The password field in the original user has been changed to authentication_string
Because of version updates, many online tutorials are not applicable, and even the documents on the official website cannot be operated smoothly.
If MySQL is running, first:
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 &
Connect to the server using mysql
Change Password:
update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';
* Note that the Password field is no longer in the user table of the new mysql database.
Instead, the encrypted user password is stored in the authentication_string field.
mysql> flush privileges;mysql> quit;
Modification completed. Restart
killall -TERM mysqld。mysqld_safe &
Then mysql can be connected.
However, at this time, the operation seems to be not fully functional, but also alter user...
alter user 'root'@'localhost' identified by '123';
The net says that the sauce Purple can also:
set password for 'root'@'localhost'=password('123');cp mysql.server /etc/init.d/mysqlchmod +x /etc/init.d/mysqlchkconfig --add mysql
Articles you may be interested in:
- MySQL 5.7 enhanced version Semisync Replication Performance Optimization
- How to install the latest MySQL version 5.7.9in mac OS X10.10
- Mysql5.7 how to forget the root password and mysql5.7 how to change the root password