Created
October 16, 2021 11:32
-
-
Save SeyedMostafaAhmadi/1d67c0b665317c222a612b4edbc2c320 to your computer and use it in GitHub Desktop.
Disable root login without password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT host, user, password, plugin FROM mysql.user; | |
which should return something like this (with unix_socket enabled): | |
+-----------+------+--------------------------+-------------+ | |
| host | user | password | plugin | | |
+-----------+------+--------------------------+-------------+ | |
| localhost | root | <redacted_password_hash> | unix_socket | | |
+-----------+------+--------------------------+-------------+ | |
UPDATE mysql.user SET plugin = '' WHERE user = 'root' AND host = 'localhost'; | |
FLUSH PRIVILEGES; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment