Just migrated a project to the newly installed linux system, because mysql is used to install it:
Yum install mysql
Yum install mysql-server
Then start the mysql service:
Service mysqd start
At this time, you can log on, but the root user should have no password, which is not secure, so set the password:
Mysqladmin password '200'
Then, you cannot log on... No matter whether you enter the password 123 or not, you cannot log on... Thank you for your answers.
I can only stop the service first, and then reset the password. The second step is to enter mysql in special mode, not long term:
Service mysqld stop
Mysqld_safe -- skip-grant-tables &
Okay, you can go:
Mysql-uroot-p
Select database:
Use mysql;
Set password:
Update user set password = PASSWORD ("newpass") where user = "root ";
Update permission:
Flush privileges;
Exit:
Quit
Restart the mysql service:
Service mysqld restart
Enter the new password:
Mysql-uroot-p