Several popular online crack mysql root password in several ways:
Method One
use phpmyadmin, this is the easiest, and modify the mysql user table, but do not forget to use the PASSWORD function.
Method Two
used mysqladmin, which is a special case of the previous declarations.
mysqladmin-u root-p password mypasswd
enter this command, you need to enter the root of the original password, and then the root password will be changed to mypasswd.
The command in the root to your user name, you can change your own password.
Of course, if your connection is not on mysqladmin mysql server, or you do not implement mysqladmin, then this method is ineffective, and not the mysqladmin password empty.
The following methods are in the mysql prompt, and must have mysql's root permissions:
Method Three
MySQL> Insert INTO mysql.user (Host, User, Password)
VALUES ('%',' Jeffrey ', PASSWORD (' Biscuit ' ));
MySQL> FLUSH PRIVILEGES
Rather it is to add a user, the user name jeffrey, the password for the biscuit.
In the "mysql reference manual in Chinese," there are the examples, so I will write out.
Note To use the PASSWORD function, and then also use the FLUSH PRIVILEGES.
Method four
and three different methods, but use the REPLACE statement,
MySQL> REPLACE INTO mysql.user (Host, User, Password)
VALUES ('%',' Jeffrey ', PASSWORD (' Biscuit '));
MySQL> FLUSH PRIVILEGES
Method Five
using the SET PASSWORD statement,
MySQL> SET PASSWORD FOR Jeffrey @ "% "= PASSWORD ('Biscuit');
to be used must also be PASSWORD () function, but do not use the FLUSH PRIVILEGES.
use phpmyadmin, this is the easiest, and modify the mysql user table, but do not forget to use the PASSWORD function.
Method Two
used mysqladmin, which is a special case of the previous declarations.
mysqladmin-u root-p password mypasswd
enter this command, you need to enter the root of the original password, and then the root password will be changed to mypasswd.
The command in the root to your user name, you can change your own password.
Of course, if your connection is not on mysqladmin mysql server, or you do not implement mysqladmin, then this method is ineffective, and not the mysqladmin password empty.
The following methods are in the mysql prompt, and must have mysql's root permissions:
Method Three
MySQL> Insert INTO mysql.user (Host, User, Password)
VALUES ('%',' Jeffrey ', PASSWORD (' Biscuit ' ));
MySQL> FLUSH PRIVILEGES
Rather it is to add a user, the user name jeffrey, the password for the biscuit.
In the "mysql reference manual in Chinese," there are the examples, so I will write out.
Note To use the PASSWORD function, and then also use the FLUSH PRIVILEGES.
Method four
and three different methods, but use the REPLACE statement,
MySQL> REPLACE INTO mysql.user (Host, User, Password)
VALUES ('%',' Jeffrey ', PASSWORD (' Biscuit '));
MySQL> FLUSH PRIVILEGES
Method Five
using the SET PASSWORD statement,
MySQL> SET PASSWORD FOR Jeffrey @ "% "= PASSWORD ('Biscuit');
to be used must also be PASSWORD () function, but do not use the FLUSH PRIVILEGES.
Method six
GRANT ... IDENTIFIED BY statement using the
MySQL> GRANT USAGE ON *.* TO Jeffrey @ "% "IDENTIFIED BY 'Biscuit';
Here PASSWORD () function is unnecessary and does not need to use the FLUSH PRIVILEGES.
GRANT ... IDENTIFIED BY statement using the
MySQL> GRANT USAGE ON *.* TO Jeffrey @ "% "IDENTIFIED BY 'Biscuit';
Here PASSWORD () function is unnecessary and does not need to use the FLUSH PRIVILEGES.
Note: PASSWORD () [not] to the Unix password encryption in the same way as the implementation of password encryption.
MySQL forgotten password solution
if MySQL is running, the first kill: killall-TERM mysqld.
Start MySQL: bin / safe_mysqld-skip-grant-tables &
you can access MySQL without a password.
Then is the
> use MySQL
> Update user set password = password ("new_pass") where user = "root";
> flush privileges;
re-kill MySQL, use the normal way to start MySQL.
MySQL forgotten password solution
if MySQL is running, the first kill: killall-TERM mysqld.
Start MySQL: bin / safe_mysqld-skip-grant-tables &
you can access MySQL without a password.
Then is the
> use MySQL
> Update user set password = password ("new_pass") where user = "root";
> flush privileges;
re-kill MySQL, use the normal way to start MySQL.
mysql password is empty
Windows:
1. with the system administrator login.
2 Stop the MySQL service.
3 into the command window, then enter the MySQL installation directory, for example, my installation directory is c: \ mysql, enter C: \ MySQL \ bin
4. Skip permission checks start MySQL,
c: \ MySQL \ bin> mysqld-NT -Skip-Grant-Tables
5. re-open a window into the c: \ mysql \ bin directory, set the root password for the new
c: \ MySQL \ bin> mysqladmin-u root flush-privileges password "newpassword"
c: \ MySQL \ bin> mysqladmin-u root-p shutdown
will newpassword replace the root password you want to use the second command will prompt you to enter a new password, repeat the first command typed password.
6 Stop MySQL Server, Mysql using normal mode
7. You can use the new password link to the Mysql up.
UNIX & Linux:
1. mysqld running with root or a user login system;
2. Use kill command to end off the mysqld process;
3. Use-skip-grant-tables parameter to start the MySQL Server
shell> mysqld_safe-Skip-Grant-Tables &
4. to root @ localhost new password
shell> mysqladmin-u root flush-privileges password "newpassword"
5. Restart MySQL Server
Windows:
1. with the system administrator login.
2 Stop the MySQL service.
3 into the command window, then enter the MySQL installation directory, for example, my installation directory is c: \ mysql, enter C: \ MySQL \ bin
4. Skip permission checks start MySQL,
c: \ MySQL \ bin> mysqld-NT -Skip-Grant-Tables
5. re-open a window into the c: \ mysql \ bin directory, set the root password for the new
c: \ MySQL \ bin> mysqladmin-u root flush-privileges password "newpassword"
c: \ MySQL \ bin> mysqladmin-u root-p shutdown
will newpassword replace the root password you want to use the second command will prompt you to enter a new password, repeat the first command typed password.
6 Stop MySQL Server, Mysql using normal mode
7. You can use the new password link to the Mysql up.
UNIX & Linux:
1. mysqld running with root or a user login system;
2. Use kill command to end off the mysqld process;
3. Use-skip-grant-tables parameter to start the MySQL Server
shell> mysqld_safe-Skip-Grant-Tables &
4. to root @ localhost new password
shell> mysqladmin-u root flush-privileges password "newpassword"
5. Restart MySQL Server
change password mysql
mysql changes in 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
mysql changes in 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 restore the MySQL database password
stored in the database because the MySQL password in the user table in mysql, so I only need to under windows 2003 user table in MySQL copied overwriting on the line.
In c: \ mysql \ data \ mysql \ (linux is generally / var / lib / mysql / mysql /) directory, there are three user table documents user.frm, user.MYD, user.MYI
user.frm / / user Table style file
user.MYD / / user table data file
user.MYI / / user table index file
for insurance purposes, the three are copied, but in fact, if you want to restore before that has not changed on the MySQL table structure, so long as copy user.MYD on the line
and then
stored in the database because the MySQL password in the user table in mysql, so I only need to under windows 2003 user table in MySQL copied overwriting on the line.
In c: \ mysql \ data \ mysql \ (linux is generally / var / lib / mysql / mysql /) directory, there are three user table documents user.frm, user.MYD, user.MYI
user.frm / / user Table style file
user.MYD / / user table data file
user.MYI / / user table index file
for insurance purposes, the three are copied, but in fact, if you want to restore before that has not changed on the MySQL table structure, so long as copy user.MYD on the line
and then
#. / Etc / rc.d / init.d / MySQL stop
#. / etc / rc.d / init.d / MySQL Start
# MySQL-u root-P XXXXXX
#. / etc / rc.d / init.d / MySQL Start
# MySQL-u root-P XXXXXX
Well, you can use windows 2003 landed under the mysql password
MySQL> use MySQL
MySQL> Update user set Password = PASSWORD ('xxxxxx') where User = 'root';
MySQL> Update user set Password = PASSWORD ('xxxxxx') where User = 'root';
To be wrong this time, suggesting that only read access to the user table
I analyze the reasons, just like this, because the user .* file permission assignment is under windows 2003, windows 2003, under the ls-l to see my permissions are 666
in linux Next I saw, after the authority becomes a copy over 600 (in fact, under normal circumstances, 600 on the line, but here the owner of the file is not mysql, copy after the owner came into the root, so there will be insufficient privileges, this time If you can change the permissions 666, and of course this is not good, does not solve the essence of the problem), in the / var / lib / mysql / mysql / ls-l looked at the next
re-
I analyze the reasons, just like this, because the user .* file permission assignment is under windows 2003, windows 2003, under the ls-l to see my permissions are 666
in linux Next I saw, after the authority becomes a copy over 600 (in fact, under normal circumstances, 600 on the line, but here the owner of the file is not mysql, copy after the owner came into the root, so there will be insufficient privileges, this time If you can change the permissions 666, and of course this is not good, does not solve the essence of the problem), in the / var / lib / mysql / mysql / ls-l looked at the next
re-
# Chown-R MySQL: MySQL user .*
# chmod 600 user .*
# chmod 600 user .*
/ / OK, DONE
weight from about MYSQL
reconnect
weight from about MYSQL
reconnect
MySQL> use MySQL
MySQL> Update user set Password = PASSWORD ('xxxxxx') where User = 'root';
MySQL> FLUSH PRIVILEGES;
MySQL> Update user set Password = PASSWORD ('xxxxxx') where User = 'root';
MySQL> FLUSH PRIVILEGES;
It is worth noting: If you are under windows mysql is the default configuration if so, attention should also perform
MySQL> DELETE from user where User = ";
MySQL> DELETE from user where Host ='%';
MySQL> FLUSH PRIVILEGES;
MySQL> DELETE from user where Host ='%';
MySQL> FLUSH PRIVILEGES;
Well, here the password recovery process is complete is a little bit what the limitations of this method, you must also have a separate user table file ###################### ################################################## ######## Other There are several ways to approach one another (this is a wider spread of the Internet means, mysql reference manual on the Chinese) 1 to the mysqld server to send the kill command to turn off the mysqld server (not kill - 9), the process ID of the file is usually stored in the MYSQL database directory.
killall-TERM mysqld
killall-TERM mysqld
You have to be UNIX root user or you are running SERVER on the same user to perform this operation.
2 Using `-skip-grant-tables' parameter to start mysqld. LINUX follows:
2 Using `-skip-grant-tables' parameter to start mysqld. LINUX follows:
/ Usr / bin / safe_mysqld-skip-grant-tables, windows, under c: \ mysql \ bin \ mysqld-skip-grant-tables
3 and no password to log on to mysqld server,
> Use MySQL
> Update user set password = password ("new_pass") where user = "root";
> flush privileges;
> 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 "
mysqladmin-H hostname-u user password 'new password "
4. Permissions table load:
`
mysqladmin-H hostname flush-privileges'
mysqladmin-H hostname flush-privileges'
Or use the SQL command
`FLUSH PRIVILEGES '
5.
killall-TERM mysqld
killall-TERM mysqld
6 with the new password to log ############################################ #################################### other methods two hex editor to directly edit the user. MYD file , but inside I want to illustrate this point, I've found a problem when editing, some of the encrypted password string is stored continuously, some of the last two were cut, stored in the back after the two other places. This I did not want to understand. there attention to the fact that editing is the encrypted password string, which means you still need another user table file. This method and my method described above difference is that this approach to directly edit files under linux user table, you do not need to re-change the file owner and permissions of the amendment this: I'm on Windows under the actual operation is as follows 1. shut down a running MySQL. 2 Open a DOS window, go to mysql \ bin directory. 3 Enter
mysqld-nt-skip-grant-tables
mysqld-nt-skip-grant-tables
Enter. If not prompted, you're right.
4. To open a DOS window (DOS window because that just has not moved), go to the mysql \ bin directory.
5 Enter the mysql Enter, if successful, the MySQL prompt>
6. permissions to the database connection
4. To open a DOS window (DOS window because that just has not moved), go to the mysql \ bin directory.
5 Enter the mysql Enter, if successful, the MySQL prompt>
6. permissions to the database connection
> Use MySQL;
(> prompt is already there, do not forget the final semicolon)
(> prompt is already there, do not forget the final semicolon)
6 to change the password:
> Update user set password = password ("123456") where user = "root"; (do not forget the final semicolon)
7. Refresh privileges (necessary steps)
> Flush privileges;
8 Exit
> \ Q
9 log off the system, re-entry, open MySQL, use the username root and password 123456 just set a new land.
It is said that can be used to directly modify the user table file approach:
turn off MySQL, Windows, open the Mysql \ data \ mysql, there are three files user.frm, user.MYD, user.MYI find know the password of MySQL, replace the corresponding three file, if the user did not turn over the table structure, usually no one to change, replace user.MYD it.
You can also directly edit user.MYD, find a hex editor, UltraEdit have this feature. Close MySQL, open user.MYD. Behind the user name of eight characters to root 565491d704013245, the new password is 123456. Or their corresponding hexadecimal numbers (on the left, where a character corresponding to the two numbers), to 0,002,020,202,020,202, which is an empty password, the editor the right to see an asterisk are *, looks like a decimal point. Reopen MySQL, enter root and your new password.
It is said that can be used to directly modify the user table file approach:
turn off MySQL, Windows, open the Mysql \ data \ mysql, there are three files user.frm, user.MYD, user.MYI find know the password of MySQL, replace the corresponding three file, if the user did not turn over the table structure, usually no one to change, replace user.MYD it.
You can also directly edit user.MYD, find a hex editor, UltraEdit have this feature. Close MySQL, open user.MYD. Behind the user name of eight characters to root 565491d704013245, the new password is 123456. Or their corresponding hexadecimal numbers (on the left, where a character corresponding to the two numbers), to 0,002,020,202,020,202, which is an empty password, the editor the right to see an asterisk are *, looks like a decimal point. Reopen MySQL, enter root and your new password.