Create an account and obtain permissions without knowing the MySQL account password
1,Log on to MySQL with the root account
Mysql-h10.0.0.1-uroot-p123
2,You do not know the account.
A)Run mysqld-NT -- skip-grant-tables in one cmd.And then directly run MySql in another cmd to log on directly.
B)Modify my. ini to skip MySQL verification.
[Mysqld]
Skip-grant-tables
# The TCP/IP Port the MySQL server will listen on
Port = 3306
3,After successful logon, you can log on to the system without changing the user password.
A)Save original password
Mysql> select host, user, password from mysql. User ;--The encrypted string that records the password, such as AAAA.
B)Change User Password
Update mysql. User SET Password ="You know the encrypted string of the password. "-you can log on to the user system after modification.
C)Restore the original User Password
Update mysql. User SET Password = "AAAA"
D)If you have high user permissions, you can log on to the system using the password modified by step B to create a high-level account or authorize before step C.
Mysql> use MySQL;
Mysql> Update user SET Password = PASSWORD ('New Password ') where user = 'root ';
Mysql> flush privileges;
Mysqladmin-uUsername-P old Password New Password
4,Add new user
Grant select, insert, update, delete on *. * To test1 @ "%" identified by "ABC ";
Grant select, insert, update, delete on mydb. * To Test2 @ localhost identified by "ABC ";
Grant select, insert, update, delete on mydb. * To Test2 @ localhost identified "";
5,OK, Close.