MYSQL forgot the superuser password change, mysql User Password Change

Source: Internet
Author: User

MYSQL forgot the superuser password change, mysql User Password Change

# Service mysql stop # mysqld_safe -- skip-grant-tables another SSH connection or terminal [root @ localhost ~] # Mysqlmysql> use mysqlmysql> update user set password = password ("123456") where user = "root"; mysql> flush privileges; mysql> exit

Then, when you enter mysql again, you need to set the password again.



This works.

How can I change the root password of a mysql Super User?

I have seen how to overwrite key files.
On the Linux platform, I forgot the MySql superuser management password. How can I change the password and regain control?

1. Stop the MYSQL service first

# Service mysql stop

2. It is difficult to run and skip permissions in mysql Security Mode

# Mysqld_safe -- skip-grant-tables

3. Use root to log on. No Password is required.

# Mysql-u root

4. Change the password now

Mysql> use mysql;

Mysql> update user set Password = PASSWORD ('your newpassword') where User = 'root ';

Mysql> exit

Note: When 'mysqld_safe -- skip-grant-tables 'is run, it stops at 'starting mysqld daemon with databases from/var/lib/mysql'. You can start a remote terminal and continue the operation.

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: 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.