1. Modify MySQL login settings:
# vi /etc/my.cnf
Add a sentence to the [mysqld] section: skip-grant-tables
For example:
[mysqld]
datadir=/var/lib/mysql
socket=/var/ lib/mysql/mysql.sock
skip-grant-tables
3. 4. Restart mysqld
. Log in and modify the root password of MySQL. /usr
/bin/mysql -u root -p
press Enter to enter mysql
mysql> USE mysql ;
mysql> UPDATE user SET Password = password ( 'new-password' ) WHERE User = 'root '
Note: mysql 5.7 passwrod field has become authentication_string
5. Modify the MySQL login settings back
# vi /etc/my.cnf
Delete the skip-grant-tables added in the [mysqld] section
6. restart mysqld
Forgot mysql password change password method
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=327083931&siteId=291194637
Recommended
Ranking