Password Not forgotten
Method One:
Outside the MySQL system, use the Mysqladmin
# mysqladmin-u root-p Password "test123"
Enter Password: "Enter the original password"
Method Two:
By logging in to the MySQL system
# mysql-uroot-p Enter Password: "Enter the original password" MySQL> Usemysql;mysql> Update user set Password=password (" Test ") where user=' root '; MySQL> flush privileges;mysql> exit;
under the Linux platform forgot the MySQL Super User management password, how to change the password regain control??
Method One
1. Stop the MySQL service first
# service MySQL Stop
2. Running in MySQL Safe mode and skipping permissions is difficult
# Mysqld_safe--skip-grant-tables
Or
# mysqld_safe--skip-grant-tables &&, it means running in the background, no longer running in the background, then open a terminal.
3. Login with root, no password required at this time
# mysql-u Root
4. Start changing the password now.
mysql> use MySQL; MySQL> Update user Set Password = Password (' Your newpassword ') where user = ' root '; MySQL> Exit
Note: When running ' Mysqld_safe--skip-grant-tables ' after stopping at ' starting mysqld daemon with databases ', a new remote terminal can be opened to continue operation
Method Two
2. To modify the login settings for MySQL:
#
For example:
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock Skip-name-Resolve Skip
3. Restart Mysqld
#
4. Log in and modify the root password of MySQL
#/usr/bin/mysqlWelcome to the MySQL Monitor. CommandsEndwith ; or \g. Your MySQL Connection ID is3 to Server version:3.23.56Type ' help; ' or ' \h ' forHelp . Type ' \c ' to clear the buffer. MySQL>Use MySQL; Reading Table Information forCompletion of table and column names you can turn off this feature to get a quicker startup with-A Database changed MySQL> UPDATE user SET Password = Password (' New-password ') WHERE user =' root '; Query OK,0 Rows Affected (0.00sec) Rows matched:2 changed:0 warnings:0MySQL>flush Privileges; Query OK,0 rows affected (0.01sec) MySQL>quit Bye
5. Change MySQL login settings back
#
6. Restart Mysqld
#
Method Three:
If you forget your MySQL root password, you can recover it by following the procedure below.
1. Send the KILL command to MYSQLD server to turn off MYSQLD server (not kill-9), the file that holds the process ID is usually in the same directory as the MySQL database.
Kill ' Cat/mysql-data-directory/hostname.pid '
You must be the root user of Unix or an equivalent user on the server you are running in order to perform this operation.
2. Use
parameter to start the mysqld.
3. Use
' mysql-h hostname mysql '
command to log on to MYSQLD server and change the password with the grant command. You can also do this:
' Mysqladmin-h hostname-u user password ' new password '.
(In fact, you can also use MySQL; Update user Set Password =password (' Yourpass ') where user= ' root ' to do so. )
4. Load Permission table:
' Mysqladmin-h hostname flush-privileges ',
or use the SQL command
' FLUSH privileges '.
(Of course, you can also restart mysqld here.) )
Method Four: (Must be backed up first)
1, re-install the same version of MySQL on another computer
2. Delete all contents of \data\mysql in MySQL installation directory in the Forgotten password computer (to stop the MySQL service first)
3,copy the entire contents of \data\mysql in the MySQL installation directory on the newly installed computer to the directory that was just deleted
4. Start the MySQL service
So there is only one root user, the password is empty ...
Mysql-linux Password modification, forget password modification, Super Admin user Modify