Mysql5.7 forgot root password and mysql5.7 method to modify root password

change the password:

1

mysql> update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';

 

1

2

mysql> flush privileges;

mysql> quit;

Modified. reboot

 

Since the latest version of linux system, the default is Mariadb instead of mysql!

Installation using the system's own repos is simple:

 

yum install mariadb mariadb-server

systemctl start mariadb ==> 启动mariadb

systemctl enable mariadb ==> boot self-start

mysql_secure_installation ==> set root password, etc.

mysql -uroot -p123456 ==> Test login!

end! Author: [email protected]

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326008880&siteId=291194637