I forgot my mysql login password in CentOS, what should I do? We can use the safe mode to change the password.
Stop the mysql database:
#service mysqld stop
Continue to enter in the CentOS system:
#mysql -udebian-sys-maint -p
The password can be directly typed in and press enter.
Reset the password in CentOS system:
mysql> update mysql.user set password=password("123456") where user="root";
Refresh permissions
mysql>flush privileges;
drop out
mysql>exit;
Start mysql and continue the previous login actions.
# service mysqld start
# mysql -u root –p