MySQL Database root Password forgot Solution

Source: Internet
Author: User

I. Windows cracking:
1. Stop the mysql Service
2. Enter the command window, enter the bin directory under the mysql installation directory, skip permission detection, and start mysql
Mysql \ bin> mysqld-nt -- skip-grant-tables
3. open a new window, go to the bin directory, and set a new root password.
Mysql \ bin> mysqladmin-u root flush-privileges password "newpassword"
Mysql \ bin> mysqladmin-u root-p shutdown prompts you to enter the password and enter newpassword to enter the database
4. Stop mysql server, start mysql in normal mode, and then use the above account to log on to the database.

Ii. Linux cracking:
Vi/etc/my. cnf # add a line of skip-grant-tables in it # Save and exit # restart mysql services mysql restart # You do not need to password mysql-uroot-p when logging on to mysql # modify the root password of mysql use mysql; update user set password = password ('000000') where user = 'root'; # Last

Vi/etc/my. cnf
# Add a row in it
Skip-grant-tables
# Save and exit
# Restart the mysql Service
Services mysql restart
# You do not need a password to log on to mysql.
Mysql-uroot-p
# Modifying the mysql root Password
Use mysql;
Update user set password = password ('000000') where user = 'root ';
# Last refresh permission
Flush privileges
Quit

Solution to Mysql5.0 root Password loss

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.