Questions about forgetting the MySQL Root User Password

Source: Internet
Author: User
My colleague's MySQL database password has been forgotten. I checked my database online and tried it on my machine. The results and results of my database were no longer accessible. I was so depressed! My database was good. There were a bunch of tables in it, and there was no backup !! Please be careful next time. Make a backup before you do not know what to do !! A painful lesson: _____________________________________________________________________________________________________________________________________ error message about forgetting the MySQL Root User Password:

Java. SQL. sqlexception: Access denied for user 'root' @ 'localhost' (using password: Yes )'
And

If you forgetMySQLOfRootUserPasswordYou can perform the following operations (Linux):

If MySQL is running, killall-term mysqld is first killed.

Start MYSQL: Bin/safe_mysqld -- skip-grant-tables

Mysql-uroot can be accessed without a password.

Then

> Use MySQL

>

Update

User SET Password = PASSWORD ("new_pass") where user = "root ";

> Flush privileges;

Kill MySQL again and start MySql in a normal way.

 

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.