Skip to content

Instantly share code, notes, and snippets.

@holly
Last active August 1, 2021 06:35
Show Gist options
  • Select an option

  • Save holly/5b67127eefa9e39bee3524b26bad38f6 to your computer and use it in GitHub Desktop.

Select an option

Save holly/5b67127eefa9e39bee3524b26bad38f6 to your computer and use it in GitHub Desktop.
-- for 5.6
-- UPDATE mysql.user SET Password=PASSWORD('your_password') WHERE User='root';
-- for generic
-- ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_password';
-- for 5.7
-- UPDATE user SET authentication_string=PASSWORD('your_password') WHERE User='root';
-- for 8.0
INSTALL COMPONENT 'file://component_validate_password'
SET GLOBAL validate_password.policy = 'LOW'
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password';
DELETE FROM mysql.user WHERE User='';
DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
DROP DATABASE IF EXISTS test;
DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';
FLUSH PRIVILEGES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment