I have logged in to MySQL with the --skip-grant-tables option. But I don't know how to get all privileges back to the root user.
I tried:
GRANT ALL PRIVILEGES ON * . * TO 'root'@'localhost';
MySQL said:
# 1290 - The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
Trying:
GRANT ALL PRIVILEGES ON * . * TO 'root'@'localhost'
WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0
MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
MySQL said:
# 1290 - The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
Answer: In MySQL, you can use the SHOW GRANTS command to display all grant information for a user. This would display privileges that were assigned to the user using the GRANT command.
To tell the server to reload the grant tables, perform a flush-privileges operation. This can be done by issuing a FLUSH PRIVILEGES statement or by executing a mysqladmin flush-privileges or mysqladmin reload command.
For mysql 8.0.12+
I've tried the documentation (not working) I've tried various other options, all failed.
PASSWORD()
is deprecated, SET PASSWORD
is disabled, ALTER USER
is disabled as well.
/usr/local/mysql/bin/mysqld_safe --skip-grant-tables
update user set authentication_string='' where User='root';
killall mysqld
Now you can use set password
or alter user
after logging in without a password
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With