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

How does Mysql skip permissions and perform operations?

不言
Release: 2018-08-18 17:47:53
Original
2085 people have browsed it

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
Copy after login

2. Start mysql without checking permissions

##

mysqld_safe --skip-grant-tables
Copy after login

3. Log in to mysql

mysql -uroot
Copy after login

4. Change the root user password

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

5. Refresh permissions

flush privileges;
quit
Copy after login

6. Restart MySQL

service mysql restart
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template