How to use skip-grant-tables in MySQL?

In MySQL, the skip-grant-tables parameter is used to bypass the authorization table check, allowing users to log in to the MySQL server without the correct permissions.

To use the skip-grant-tables parameter, follow these steps:

  1. Stop the MySQL server.
  2. Open the MySQL configuration file. On Linux, the configuration file is typically located at /etc/mysql/mysql.conf.d/mysqld.cnf or /etc/my.cnf. On Windows, the configuration file is typically located at C:\ProgramData\MySQL\MySQL Server 8.0\my.ini.
  3. Add or modify the “skip-grant-tables” parameter in the [mysqld] section. If the parameter already exists, make sure to set it to “true” or “1”. Example: skip-grant-tables=1.
  4. Save and close the configuration file.
  5. Start the MySQL server.

You can now log into the MySQL server as a user without proper permissions. Please be aware that a user logging in with the skip-grant-tables parameter will have full privileges to modify any database and table.

Important reminder: Logging into the MySQL server with the skip-grant-tables parameter is a risky practice, as anyone can modify databases and tables. It is recommended to only use this parameter in emergency situations, and to immediately restore normal authorization table checks once the necessary operations are completed.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds