Summary in many cases, the default password of the root user is not blank after mysql is installed. in this case, you need to log on to mysql to reset the password. Step 1: Check the root. mysql_secret file to install mysql. a random password is generated for the first time. you can use this password to log on.
In many cases, the default password of the root user is not blank after mysql is installed. in this case, you need to log on to mysql to reset the password.
Procedure
Method 1: view the/root/. mysql_secret file
The first time mysql is installed, a random password is generated. you can log on with this password. the random password has been generated and can be found in '/root/. mysql_secret.
Method 2: Use mysqladmin
Mysqladmin cannot change password
Mysqld_safe -- skip-grant-tables &
Mysql-uroot-p
Use mysql;
Update user set password = PASSWORD ("newpassword") where user = "root ";
Flush privileges;
Quit
Method 3: Add "skip-grant-tables"
Add "skip-grant-tables" in the/etc/my. cnf [mysqld] configuration section"
Restart mysql service
Service mysqld restart
Log on to mysql
Mysql-uroot-p mysql
Use mysql;
Update user set password = password ("password") where user = 'root ';
Update
Flush privileges;
Delete "skip-grant-tables" in the/etc/my. cnf [mysqld] configuration section"
Restart mysql service
Service mysqld restart
Log on with the new password
Mysql-uroot-p
After the PASSWORD is changed, the first logon ERROR may be 'error 1820 (HY000): You must set password before executing this statement '. You need to change the current logon PASSWORD again.
Change current user password
Set password = PASSWORD ('20140901 ')