Last active
May 7, 2021 20:07
-
-
Save miaoles/c802610df2aa357b782148741d210aca to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
PASSWORD='pa$$w0rd' | |
for name in $(cat users.txt); do | |
sudo mysql> CREATE DATABASE '$name' | |
sudo mysql> CREATE USER '$name'@'localhost' identified by '${PASSWORD}'; | |
sudo mysql> GRANT ALL PRIVILEGES ON ${name}.* TO '$name'@'localhost' IDENTIFIED BY '${PASSWORD}' | |
echo "User $name created with password $PASSWORD with database $name" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment