Today's database connection, suddenly found that the database password forgot, this can do, really scared the baby, through the experiment, finally found a method, only for reference ...
The general approach to accessing the database is as follows: By logging into the MySQL system,
# mysql-uroot-p Enter Password: "Enter your original password" 12
But then how do I input, are not into the database, do not be afraid, below I teach you how to enter the database, follow me
Linux Edition
First, close your MySQL
# sudo service mysql stop # mysqld_safe--skip-grant-tables &12
Describes a very useful mysql boot parameter ——--Skip-grant-tables. As the name implies, when you start MySQL, do not start the grant-tables, authorization table. What's the use of it? Of course it is useful to forget the administrator password.
# mysql 1
Go to MySQL
mysql> use MySQL; mysql> Update user Set Password=password ("New password you want to set") where user= "root"; 123
Take the root user as an example
Mysql> Flush Previleges;1
Windows edition
(Online search for information, no experiments, for reference only)
Close the running MySQL service.
Open the DOS window and go to the mysql\bin
directory.
Enter a mysqld --skip-grant-tables
carriage return. --skip-grant-tables
This means that when you start the MySQL service, you skip permission table authentication.
Open a DOS window again (because the DOS window just can't move), go to the mysql\bin
directory.
Enter MySQL return and, if successful, the MySQL prompt > will appear.
Connection Permissions database: >use mysql;
.
Change the password: >update user set password=password("123") where user="root";
(don't forget to add a semicolon at the end).
Refresh permissions (required steps): >flush privileges;
.
Exit >quit;
.
Log out of the system, and then enter, using the username root and the new password just set to 123 login.
This article is from the "Gaovan" blog, make sure to keep this source http://gaowanyao.blog.51cto.com/11272977/1913802
Forget the MySQL database password, what should I do???