Get the App
SLTechnology News&Howtos  ›  Database  › 

[data relocation] mysql problem

Shulou Source: shulou.com Published: 2022-06-01 06:24:18 09月25日 Update

I don't know what happened, I executed an authorization statement, hoping that any machine could connect to mysql remotely, and set a password for the root user of mysql, but when restarting linux, I could not log in with the new password of the root user, but I could log in with root without any password. After connecting to mysql, I checked the database inside and found that The original mysql library and the database I built are gone, so I can't do anything. Later, after multi-party inquiries, we found out that it was a question of permissions. The solution is as follows:

(1) killall mysqld stops mysql

(II) mysqld_safe-skip-grant-tables

(3) start another sell

(IV) / etc/init.d/mysqld start starts mysql service

(5) mysql connects to mysql

(6) so that you can see the mysql libraries and the newly built libraries

(7) use mysql

(8) update user set password=PASSWORD ('mysqladmin') where user='root'

The execution of the above statements is basically fine

Finally, it has to be refreshed: flush privileges

Authorization statement: GRANT ALL PRIVILEGES ON. TO 'root' @' localhost' IDENTIFIED BY 'newpassword' WITH GRANT OPTION

Add root user: insert into user (host,user,password) values ('localhost','root',password (' newpassword'))

Authorization: grant all privileges on. To root @ "localhost"

Tags: User statement password data database login problem method matter time machine permission new secret service query data Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Docker Microsoft Shulou Information NVidia