Skip to content

Instantly share code, notes, and snippets.

@khoimm92
Last active August 10, 2021 13:23
Show Gist options
  • Save khoimm92/3c19fe57be613fc0354dfcf784257903 to your computer and use it in GitHub Desktop.
Save khoimm92/3c19fe57be613fc0354dfcf784257903 to your computer and use it in GitHub Desktop.
MySQL 8 - create user
# create a user
mysql> CREATE USER 'khoai'@'%' IDENTIFIED BY 'khoai';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'khoai'@'%' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
# set policy
SET GLOBAL validate_password.LENGTH = 4;
SET GLOBAL validate_password.policy = 0;
SET GLOBAL validate_password.mixed_case_count = 0;
SET GLOBAL validate_password.number_count = 0;
SET GLOBAL validate_password.special_char_count = 0;
SET GLOBAL validate_password.check_user_name = 0;
ALTER USER 'user'@'localhost' IDENTIFIED BY 'pass';
FLUSH PRIVILEGES;
# incase cannot access to mysql with root (sudo mysql)
service mysql stop
mysqld_safe --skip-grant-tables --skip-networking &
mysql -u root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment