Created
March 25, 2020 18:03
-
-
Save msaladna/c7cf1bc4ec921d3f04ab850b0ab132e8 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
# Remove echo when you're ready for primetime | |
cpcmd -o json admin:collect '[mysql.enabled:1]' | jq -r 'keys[]' | while read SITE ; do | |
cpcmd -o json -d $SITE mysql:list-databases | jq -r 'values[]' | while read DB ; do | |
cpcmd -d $SITE -o json mysql:list-users | jq -r 'keys[]' | while read USER ; do | |
echo cpcmd -d $SITE mysql:set-privileges "'$USER'" "localhost" "'$DB'" "'[read:true,write:true]'" | |
done | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment