Resetting Root User Privileges Using --skip-grant-tables
If you've accidentally locked yourself out of your MySQL database as the root user, fear not. Restoring all privileges to the root user can be accomplished by starting MySQL with the --skip-grant-tables option.
Windows Environment
Edit the MySQL configuration file (my.ini) located at:
Under the [mysqld] section, add the following line:
skip-grant-tables
PostgreSQL Environment
Under the [postgresql] section, add the following line:
fsync = off
Note: The --skip-grant-tables option should be used with caution, as it temporarily disables authentication. Once you have regained access to your database, be sure to remove this option and restart MySQL.
The above is the detailed content of How Can I Reset Root User Privileges in MySQL and PostgreSQL After Accidental Lockout?. For more information, please follow other related articles on the PHP Chinese website!