Login in MySQL database security mode

Source: Internet
Author: User
When you use the mysql database to prompt for password errors or permissions, you can start the database in mysql security mode so that all users can access all the tables.

When you use the mysql database to prompt for password errors or permissions, you can start the database in mysql security mode so that all users can access all the tables.

When the mysql database prompts a Password error or a permission error, you can start the database in mysql security mode so that all users can access all tables, you can reset the password or modify the permissions.

1: first shut down the mysql database and end all mysqld processes.

# Service mysqld stop

# Killall-9 mysqld

2: log on to the database in safe mode.

# Mysql_safe -- skip-grant-tables &

3: log on to the mysql database.

# Mysql-uroot

4: Change the user password in the user table.

> Update mysql. user set Password = password ('passwd') where User = "root"

> Flush privileges;

5: grant permissions to the root user.

> Grant all on *. * to 'root' @ '%' identified by 'passwd ';

> Flush privileges;

Then you can use the root user and PASSWD password to log on to the mysql database. According to the above method, when other users forget the password, they can modify the password and grant permissions to the user.

Recommended reading:

Percona_Toolkit introduction and installation-a required tool kit for MySQL Administrators

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.