The most simple way to reset the root password of MySQL 5.7 on CentOS 7
1 2 3 4 5 6 7 8 9 10 11 12 13 |
systemctl stop mysqld systemctl set-environment MYSQLD_OPTS="--skip-grant-tables" systemctl start mysqld mysql -u root mysql> UPDATE mysql.user SET authentication_string = PASSWORD('YourNewPassword') WHERE User = 'root' AND Host = 'localhost'; mysql> FLUSH PRIVILEGES; mysql> quit systemctl stop mysqld systemctl unset-environment MYSQLD_OPTS systemctl start mysqld mysql -u root -p |