Last active
April 6, 2019 01:39
-
-
Save marcosborges/c3ddc002d4a68312c7007a7144a3f603 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
def _provisioningMysqlUser(host, master_username, master_password, new_username, new_username_password) { | |
docker.image('mysql:5').inside(" --net=host ") { | |
def sqlCreateUser = "CREATE USER '${new_username}'@'%' IDENTIFIED BY '${new_username_password}';" | |
sh """ mysql -h ${host} -u ${master_username} --password="${master_password}" -e "${sqlCreateUser}" """ | |
def sqlGrantAllPriv = "GRANT ALL PRIVILEGES ON *.* TO '${new_username}'@'%';" | |
sh """ mysql -h ${host} -u ${master_username} --password="${master_password}" -e "${sqlGrantAllPriv}" """ | |
} | |
} | |
node{ | |
_provisioningMysqlUser( | |
"127.0.0.1", | |
"root", | |
"root", | |
"new_username", | |
"new_username_password" | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment