Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #docker exec -i CONTAINER_ID /bin/bash -c "export VAR1=VAL1 && export VAR2=VAL2 && run_cmd"
- DB_PW=`openssl rand -base64 32`
- OPTS="-uroot -h 127.0.0.1 -ve"
- echo $DB_PW
- mysql $OPTS "CREATE USER '$1'@'%' IDENTIFIED BY '$DB_PW';";
- mysql $OPTS "CREATE DATABASE $1;";
- mysql $OPTS "GRANT ALL PRIVILEGES ON $1.* TO '$1'@'%' WITH GRANT OPTION;";
- mysql $OPTS "SET PASSWORD FOR '$1'@'%' = PASSWORD('$DB_PW');";
- mysql $OPTS "FLUSH PRIVILEGES;";
Add Comment
Please, Sign In to add comment