Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SeyedMostafaAhmadi/1d67c0b665317c222a612b4edbc2c320 to your computer and use it in GitHub Desktop.
Save SeyedMostafaAhmadi/1d67c0b665317c222a612b4edbc2c320 to your computer and use it in GitHub Desktop.
Disable root login without password
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