Ubuntu under MySQL forgot root password reset

Source: Internet
Author: User
Tags mysql login

Does MySQL forget root password swelling?   -_-||| This is not a very common situation, but sometimes the system is not logged in for a long time, and it really forgets the password. At this time, if you can access the password with system administrator privileges, it is still saved. Enlarge the Strokes and reset them.

1. Modify the MySQL login settings

Vi/etc/mysql/my.cnf

Add a sentence to the paragraph in [mysqld]: Skip-grant-tables

: Wq

Save Settings and Exit VI

2. Restart Mysqld

sudo service MySQL restart

3. Log in and modify the root password of MySQL

Go to MySQL Environment

Mysql

Switch to "MySQL" Database

Use MySQL;

Change root password

UPDATE user SET Password = Password (' New-password ') WHERE user = ' root ';

Make effective

Flush privileges;

Exit MYQL Environment

\q

5. Change the MySQL login settings back

Vi/etc/mysql/my.cnf

Delete the skip-grant-tables you just added in the paragraph [mysqld]

: Wq

Save and Exit VI

6. Restart the MySQL service

sudo service MySQL restart

The operation is complete.

original articles, reproduced please specify: reproduced from http://www.mr-wu.cn/Wuchuanbin blog

This article link address: Ubuntu under MySQL forgot root password reset http://www.mr-wu.cn/mysql-reset-root-password-on-ubuntu/

Ubuntu under MySQL forgot root password reset

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.