Last active
August 10, 2021 13:23
-
-
Save khoimm92/3c19fe57be613fc0354dfcf784257903 to your computer and use it in GitHub Desktop.
MySQL 8 - create user
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
# 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