Home > Database > Mysql Tutorial > How to regain MySQL root access using the --skip-grant-tables option?

How to regain MySQL root access using the --skip-grant-tables option?

Barbara Streisand
Release: 2024-12-01 04:12:12
Original
392 people have browsed it

How to regain MySQL root access using the --skip-grant-tables option?

Starting MySQL with --skip-grant-tables

Locking out the root user from a MySQL database can be a frustrating experience. To regain access and restore privileges, it's necessary to start MySQL with the --skip-grant-tables option.

Step 1: Stop the MySQL Service

For Windows users, stop the MySQL service using the Administrator tools within Services.

Step 2: Edit the my.ini Configuration File

Locate the my.ini configuration file, typically found in one of these paths:

  • C:Program FilesMySQLMySQL Server 5.5my.ini (for MySQL 5.5)
  • C:ProgramDataMySQLMySQL Server 5.6my.ini (for MySQL versions >= 5.6)

Step 3: Add the --skip-grant-tables Option

In the [mysqld] section of the file, add the following line:

skip-grant-tables
Copy after login

Step 4: Restart the MySQL Service

Start the MySQL service again. You should now be able to log in to your database without a password and regain access to the root user.

The above is the detailed content of How to regain MySQL root access using the --skip-grant-tables option?. For more information, please follow other related articles on the PHP Chinese website!

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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template