Forget the MySQL database password, what should I do???

Source: Internet
Author: User
Tags administrator password

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)

  1. Close the running MySQL service.

  2. Open the DOS window and go to the mysql\bin directory.

  3. Enter a mysqld --skip-grant-tables carriage return. --skip-grant-tablesThis means that when you start the MySQL service, you skip permission table authentication.

  4. Open a DOS window again (because the DOS window just can't move), go to the mysql\bin directory.

  5. Enter MySQL return and, if successful, the MySQL prompt > will appear.

  6. Connection Permissions database: >use mysql; .

  7. Change the password: >update user set password=password("123") where user="root"; (don't forget to add a semicolon at the end).

  8. Refresh permissions (required steps): >flush privileges;  .

  9. Exit >quit; .

  10. 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???

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.