Create an account and obtain permissions without knowing the MySQL account password

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.