Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save decodedmrq/7a18702f50ae255c59cb21b3cfee5a4f to your computer and use it in GitHub Desktop.
Save decodedmrq/7a18702f50ae255c59cb21b3cfee5a4f to your computer and use it in GitHub Desktop.
Change password in mysql with plugin
*auth_socket* If you install 5.7 and don’t provide a password to the root user, it will use the auth_socket plugin. That plugin doesn’t care and doesn’t need a password. It just checks if the user is connecting using a UNIX socket and then compares the username.
*mysql_native_password*
If we want to configure a password, we need to change the plugin and set the password at the same time, in the same command. First changing the plugin and then setting the password won’t work, and it will fall back to auth_socket again
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'test';
Normal change password for root mysql.user: ALTER USER 'root'@'localhost' IDENTIFIED BY '2DEyjZKiN6';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment