Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the ways to modify and crack the MYSQL password

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "what are the methods of modifying and cracking MYSQL passwords". In daily operation, I believe many people have doubts about the methods of modifying and cracking MYSQL passwords. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to you to answer the doubts of "what are the methods of modifying and cracking MYSQL passwords?" Next, please follow the editor to study!

Method one

It's easiest to use myadmin. Modify the user table of the mysql library, but don't forget to use the PASSWORD function.

Method two

Using mysqladmin, this is a special case of the previous declaration.

Mysqladmin-u root-p password mypasswd

After entering this command, you need to enter the original password of root, and then the password of root will be changed to mypasswd.

Change the root in the command to your user name, and you can change your own password.

Of course, if your mysqladmin can't connect to mysql server, or if you can't execute mysqladmin, then this method doesn't work, and mysqladmin can't clear the password.

The following methods are used at the mysql prompt and must have root permission for mysql:

Method three

Mysql > Insert INTO mysql.user (Host,User,Password)

VALUES (%, jeffrey,PASSWORD (biscuit))

Mysql > FLUSH PRIVILEGES

To be exact, this is adding a user with the user name jeffrey and the password biscuit. There is an example in the mysql Chinese reference Manual. Note that you want to use the PASSWORD function, and then use FLUSH PRIVILEGES.

Method 4

Same as method 3, except that the REPLACE statement is used

Mysql > REPLACE INTO mysql.user (Host,User,Password)

VALUES (%, jeffrey,PASSWORD (biscuit))

Mysql > FLUSH PRIVILEGES

Method five

Use the SET PASSWORD statement

Mysql > SET PASSWORD FOR "= PASSWORD (biscuit)

Simulations must also use the PASSWORD () function, but not FLUSH PRIVILEGES.

Method 6

Use GRANT... IDENTIFIED BY statement

Mysql > GRANT USAGE ON *. * TO "IDENTIFIED BY biscuit

The PASSWORD () function is unnecessary here, and you don't need to use FLUSH PRIVILEGES.

Note: PASSWORD () [not] performs password encryption in the same way that Unix passwords are encrypted.

The solution of MySQL forgetting password

If MySQL is running, kill it first:

Killall-TERM mysqld

Start MySQL:

Bin/safe_mysqld-- skip-grant-tables &

You can enter MySQL without a password.

And then there is.

> use mysql

> update user set password=password ("new_pass") where user= "root"

> flush privileges

Kill MySQL again and start MySQL in the normal way.

Clear the Mysql password

Windows

1. Log in to the system with a system administrator

two。 Stop the service of MySQL

3. Enter the command window, and then enter the MySQL installation directory. For example, my installation directory is c:mysql, and enter C:mysqlin.

4. Skip permission check to start MySQL

C:mysqlin > mysqld-nt-- skip-grant-tables

5. Reopen a window, enter the c:mysqlin directory, and set the new password for root

C:mysqlin > mysqladmin-u root flush-privileges password "newpassword"

C:mysqlin > mysqladmin-u root-p shutdown

Replace newpassword with the password of the root you want to use, and the second command prompts you to enter the new password, repeating the password entered by the first command

6. Stop MySQL Server and start Mysql in normal mode

7. You can link to Mysql with your new password.

Unix&

1. Log in to the system with root or a user running mysqld

2. End the process of mysqld by using kill command

3. Start MySQL Server with the-- skip-grant-tables parameter

Shell > mysqld_safe-- skip-grant-tables &

4. To set a new password

Shell > mysqladmin-u root flush-privileges password "newpassword"

5. Restart MySQL Server.

Mysql change password

Mysql modification can be performed on the Mysql command line as follows:

Mysql-u root mysql

Mysql > Update user SET password=PASSWORD ("new password") Where user=name

Mysql > FLUSH PRIVILEGES

Mysql > QUIT

Teach you how to recover the password of MySQL database

Because the MySQL password is stored in the user table in the database mysql, you just need to copy and overwrite the user table in MySQL under my Windows 2003.

There are three user table related files user.frm, user.MYD, user.MYI in the c:mysqldatamysql (linux is usually / var/lib/mysql/mysql/) directory.

User.frm / / user table style file

User.MYD / / user table data file

User.MYI / / user table index file

Just to be on the safe side, copy all three, but in fact, if you haven't changed the table structure on the MySQL you want to restore, just copy user.MYD.

And then

#. / etc/rc.d/init.d/mysql stop

#. / etc/rc.d/init.d/mysql start

# mysql-u root-p XXXXXX

All right, you can log in with the mysql password under Windows 2003.

Mysql > use mysql

Mysql > update user set Password=PASSWORD (xxxxxx) where User=root

An error occurs at this time, indicating that the user table only has read permissions.

I analyzed the reason, only like this, because the permission assignment of user.* file is under Windows 2003, under Windows 2003 I ls-l the permission is 666.

When I look under Linux, the permission becomes 600 (in fact, under normal circumstances, 600 is fine, but the file owner here is not mysql, but after being copied, the owner becomes root, so there will be insufficient permissions. At this time, if you change the permission to 666, of course, this is not good, there is no essence to solve the problem. Ls-l has a look under / var/lib/mysql/mysql/.

# chown-R mysql:mysql user.*

# chmod 600 user.*

/ / OK,DONE

Restart MYSQL and reconnect

Mysql > use mysql

Mysql > update user set Password=PASSWORD (xxxxxx) where User=root

Mysql > FLUSH PRIVILEGES

One thing to note: if you go to mysql, if it is the default configuration, you should also implement it.

Mysql > delete from user where User=

Mysql > delete from user where Host=%

Mysql > FLUSH PRIVILEGES

All right, this is where the password recovery process is complete. This method is a bit limited, you must also have another user table file. There are several other ways.

Other method 1 (this is a method widely spread on the Internet, in the mysql Chinese reference manual)

1. Send a kill command to mysqld server to turn off mysqld server (not kill-9), and the file where the process ID is stored is usually in the same directory as MYSQL.

Killall-TERM d

You must be a root user of UNIX or an equivalent user on the SERVER you are running to perform this operation.

two。 Use the `--skip-grant-tables parameter to start mysqld. Under LINUX:

/ usr/bin/safe_mysqld-- skip-grant-tables, c:mysqlinmysqld under windows

-- skip-grant-tables

3. Then log in to mysqld server without a password

> use mysql

> update user set password=password ("new_pass") where user= "root"

> flush privileges

You can also do this:

Mysqladmin-h hostname-u user password new password

4. Load the permissions table:

Mysqladmin-h hostname flush-privileges

Or use the SQL command

FLUSH PRIVILEGES

5.

Killall-TERM mysqld

6. Log in with a new password.

Other methods two

Edit user.MYD files directly with a hexadecimal editor.

However, I would like to make one point in this. I found a problem when editing here. Some of the encrypted password strings are stored continuously, some of the last two bits are cut open, and the last two bits are stored somewhere else. I haven't figured that out yet. It is also important to note that you are editing encrypted password strings, which means you still need to have additional user table files. The difference between this method and the one I described above is that by editing the user file under linux directly, there is no need to change the file owner and permissions.

Fix it: my actual operation under Windows is as follows

1. Close the running MySQL

two。 Open the DOS window and go to the mysqlin directory

3. Input

Mysqld-nt-skip-grant-tables

Enter. If there is no prompt, that's right.

4. Open another DOS window (because the DOS window just now cannot be moved), and change to the mysqlin directory.

5. Enter mysql to enter, and if successful, the MySQL prompt will appear >

6. Connect to the permissions database

> use mysql

(> is an existing prompt, don't forget the last semicolon)

6. Change the password:

> update user set password=password ("123456") where user= "root"

(don't forget the last semicolon)

7. Refresh permissions (required)

> flush privileges

8. Quit

> Q

9. Log out of the system, re-enter, open MySQL, and log in with the user name root and the new password 123456 you just set.

It is said that you can modify the user table file directly:

Close MySQL,Windows to open Mysqldatamysql, there are three files user.frm,user.MYD,user.MYI to find a MySQL that knows the password, replace the corresponding three files, if the user table structure has not been changed, generally no one to change, replace user.MYD on it.

You can also edit user.MYD directly and find a hexadecimal editor. UltraEdit has this feature. Close MySQL and open user.MYD. Change the eight characters after the user name root to 565491d704013245, and the new password is 123456. Or put their corresponding hexadecimal numbers

At this point, the study of "what are the ways to modify and crack MYSQL passwords" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report