Mysql administrator password retrieval, mysql administrator password
We may forget the ROOT password for various reasons when using MYSQL. If so, the database may be discarded, however, I would like to share with you today how to retrieve the ROOT password or change the root password without knowing the ROOT password. However, we recommend that you keep the root password safe, to prevent unnecessary troubles, retrieve the administrator password:
[Root @ localhost ~] # Service mysqld stop
Shutting down MySQL... [OK]
[Root @ localhost ~] # Vim/etc/init. d/mysqld
About 283 rows:
$ Bindir/mysqld_safe -- datadir = "$ datadir" -- pid-file = "$ mysqld_pid_file_path" $ other_args>/dev/null2> & 1 &
Wait_for_pid created "$! "" $ Mysqld_pid_file_path "; return_value = $?
Change
$ Bindir/mysqld_safe -- skip-grant-tables -- skip-networking
-- Datadir = "$ datadir" -- pid-file = "$ mysqld_pid_file_path" $ other_args>/dev/null2> & 1 &
Wait_for_pid created "$! "" $ Mysqld_pid_file_path "; return_value = $?
Save and exit
Mysql> use mysql
Readingtable information for completion of table and column names
You canturn off this feature to get a quicker startup with-
Databasechanged
Mysql> select user, host, password from user;
+ --------- + ----------------------- + ------------------------------------------- +
| User | host | password |
+ --------- + ----------------------- + ------------------------------------------- +
| Root | localhost | * 4941369BD46398A2BDEEC85411065D7137D4EA0F |
| Root | localhost. localdomain | * 4941369BD46398A2BDEEC85411065D7137D4EA0F |
| Root | 127.0.0.1 | * 4941369BD46398A2BDEEC85411065D7137D4EA0F |
| Tianke | % | * A399693A49F7EC7C548D0FC376FA52AD293A552F |
| Tianke1 | % | * EEAC51414F1AE247D67F47A875BDB134CF39986C |
+ --------- + ----------------------- + ------------------------------------------- +
5 rowsin set (0.01 sec)
Change root Password
Mysql> update user setpassword = password ('000000') whereuser = 'root ';
QueryOK, 3 rows affected( 0.00 sec)
Rowsmatched: 3 Changed: 3 Warnings: 0
Then stop the service again, and then change the mixed value back to restart mysql.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.