Today I have some free time. I cleaned up the databases used for small test projects and accidentally deleted one of the four databases that comes with MySQL. . . .
I was worried about whether it would affect my future development. After Baidu took a look, how could it be restored. I didn’t find the relevant tutorials, so I directly advised to reinstall. Then I installed the latest mysql 8.0 version directly, and found that Navicat could not connect. 1251 error. Through searching for information on Baidu, some operations have been integrated.
-
Open the database
net start mysql -
Log in to the root user
mysql -u root root -p
enter the password and press Enter -
Transfer to the " mysql " database
use mysql
-
Set the user's password to never expire
alter user'root'@'localhost' identified by'your root password ' password expire never;
-
Change the encryption method
alter user'root'@'localhost' identified with mysql_native_password by'your root password ';
-
Refresh rights
flush privileges;
-
Done, try it now