CENTOS7 Install mysql5.7 after login error error 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using pas
After the installation of MySQL will have a temporary password to go to the log to view, but check the login to modify the secret or not
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:yes)
So
1. Stop the MySQL service
Systemctl Stop Mysqld.service
2. Modify configuration file without password login
[HTML] view plain copy
- Vi/etc/my.cnf
At the top of the tail plus
[HTML] view plain copy
- Skip-grant-tables
Save
3. Start MySQL
[HTML] view plain copy
- Systemctl Start Mysqld.service
4, Login Musql
[HTML] view plain copy
- Mysql-u Root
Note here do not add-p
5, change the password, mysql5.7 with this syntax
[HTML] view plain copy
- Use MySQL;
[HTML] view plain copy
- Update Mysql.user set Authentication_string=password (' 123456 ') where user= ' root ';
6, go back to the second step and remove the added
[HTML] view plain copy
- Skip-grant-tables
Save the restart MySQL is ok
#########################################################################
In fact, after the default installation of MySQL or in the log to generate a default password in/var/log/mysqld.log
Login to MySQL password reset after getting the default password
[HTML] view plain copy
- Set Passwprd=password (' You password ');
If the password level does not match the default level requirements, it is reported
[HTML] view plain copy
- Your password does not satisfy the current policy requirements
At this point you need to modify the level and minimum number of default password bits
[HTML] view plain copy
- Set global validate_password_policy=0;
- Set global validate_password_length=4;
And then I'm going to set the password.
###################
1130 error when connecting remotely
[HTML] view plain copy
- Mysql;use MySQL;
- Mysql;select ' host ' from user where user= ' root ';
- Mysql;update User Set host = '% ' where user = ' root ';
- Mysql;flush privileges;
- Mysql;select ' host ' from user where user= ' root ';
Mysql 5.7 Remote Connection error