Home  >  Article  >  Database  >  How does Mysql skip permissions and perform operations?

How does Mysql skip permissions and perform operations?

不言
不言Original
2018-08-18 17:47:532060browse

This article brings you the steps on how to skip permissions in Mysql. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

I encountered such a problem while working on a project today. I forgot my mysql password, which prevented me from connecting to the database. I searched on Baidu online and it was very simple. I made a note so that I could encounter the same problem as me. The children's shoes who noticed the problem solved the problem quickly.

1. Kill the mysql process (stop the mysql service)

service mysql stop

2. Start mysql without checking permissions

##

mysqld_safe --skip-grant-tables

3. Log in to mysql

mysql -uroot

4. Change the root user password

UPDATE user SET password=PASSWORD('123456') WHERE user='root';

5. Refresh permissions

flush privileges;
quit

6. Restart MySQL

service mysql restart

It’s that simple.
Related recommendations:

How to write conditional statements for adding, deleting, modifying, and querying SQL database information? (Example)

mysql backup and restore library command method analysis (long article)

The above is the detailed content of How does Mysql skip permissions and perform operations?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn