Success Scenarios
Mysqld_safe--user=mysql--skip-grant-tables--skip-networking &
[[email protected] ~]# mysql-u root MySQL
mysql> Update user Set Authentication_string=password (' Passw0rd ') where user= ' root ';
[Email protected] ~]# mysql-u root-p
Enter Password:
After landing, the following statement modifies the password so that it conforms to the rule
Alter user ' root ' @ ' localhost ' identified by ' [email protected] ' PASSWORD EXPIRE;
or this sentence
SET PASSWORD = PASSWORD (' [email protected] ');
Allows the root user of MySQL to remotely link:
mysql -u root –p
mysql>use mysql;mysql>updateusersethost = ‘%‘whereuser= ‘root‘;mysql>selecthost, userfromuser;
FLUSH PRIVILEGES
Failure scenarios
Create a Mysql-init file with the following content:
ALTER USER ' root ' @ ' localhost ' identified by ' mynewpass ';
Then execute sudo mysqld_safe--init-file=mysql-init &
Then delete the Mysql-init
MySQL root setup password Linux