Skip to content

Instantly share code, notes, and snippets.

@hucancode
Last active June 2, 2022 01:03
Show Gist options
  • Save hucancode/951208d1a307a66081f1e1be61a12e77 to your computer and use it in GitHub Desktop.
Save hucancode/951208d1a307a66081f1e1be61a12e77 to your computer and use it in GitHub Desktop.
Create a database and an user associated with it
mysql -uroot -p -e "CREATE DATABASE mydb;CREATE USER myuser@'%' IDENTIFIED BY 'secret';GRANT ALL PRIVILEGES ON mydb.* TO myuser@'%';"
# run these if you got kicked by mysql password policy
/*
set global validate_password.policy = LOW;
set global validate_password.length = 2;
set global validate_password.mixed_case_count = 0;
set global validate_password.number_count = 0;
set global validate_password.special_char_count = 0;
*/
CREATE DATABASE mydb;
CREATE USER myuser@'%' IDENTIFIED BY 'secret';
GRANT ALL PRIVILEGES ON mydb.* TO myuser@'%';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment