Home >Database >Mysql Tutorial >How to Reset MySQL Root Password by Starting MySQL with `--skip-grant-tables` in Windows?

How to Reset MySQL Root Password by Starting MySQL with `--skip-grant-tables` in Windows?

DDD
DDDOriginal
2024-12-16 16:53:11429browse

How to Reset MySQL Root Password by Starting MySQL with `--skip-grant-tables` in Windows?

Starting MySQL with --skip-grant-tables in Windows

When your root user is locked out of your database, you may need to regain full privileges. This article provides a step-by-step guide on how to start MySQL with the --skip-grant-tables flag in Windows.

Procedure:

  1. Stop MySQL Service: Open the Services window (Windows Key R, type "services.msc") and stop the MySQL service.
  2. Modify my.ini Configuration File:

    • Locate the my.ini configuration file:

      • For MySQL 5.5: C:Program FilesMySQLMySQL Server 5.5my.ini
      • For MySQL >= 5.6: C:ProgramDataMySQLMySQL Server 5.6my.ini
    • Add the following line in the SERVER SECTION [mysqld]:
      skip-grant-tables
  3. Restart MySQL Service: Start the MySQL service again.

Once MySQL is started with the --skip-grant-tables flag, you can log into your database without a password. This allows you to reset the root user's password and restore full privileges.

The above is the detailed content of How to Reset MySQL Root Password by Starting MySQL with `--skip-grant-tables` in Windows?. 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