Last active
November 10, 2024 05:08
-
-
Save nateflink/5785237 to your computer and use it in GitHub Desktop.
Revisions
-
nateflink revised this gist
Jun 16, 2013 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,8 +4,8 @@ # Adds a mysql user, and creates a database with the same name as the user and echos the generated password if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then echo "Usage: ./$0 [mysql db username] [mysql user password] [new identifier] [optional password]" exit 1 fi DB_PASSWORD=$(env LC_CTYPE=C tr -dc "a-zA-Z0-9-_\$\?" < /dev/urandom | head -c 16) @@ -26,4 +26,5 @@ EOF ) mysql -u "$1" -p"$2" -e "$CMD" echo "$DB_PASSWORD" exit 0 -
nateflink revised this gist
Jun 16, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ # Adds a mysql user, and creates a database with the same name as the user and echos the generated password if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then echo "ERROR Usage: ./$0 [mysql db username] [mysql user password] [new identifier] [optional password]" exit fi -
nateflink revised this gist
Jun 16, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ #!/bin/bash #By Nate Flink # Adds a mysql user, and creates a database with the same name as the user and echos the generated password if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then echo "ERROR Usage: ./$0 [mysql db username] [mysql user password] [new identifier] [optional password]" exit fi -
nateflink revised this gist
Jun 16, 2013 . 1 changed file with 1 addition and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,5 @@ #!/bin/bash # By N Flink # Adds a mysql user, and creates a database with the same name as the user and echos the generated password -
nateflink revised this gist
Jun 16, 2013 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,6 @@ # \ \_\\"\_\ \ \_\ \ \_____\ \ \_\ \ \_\\"\_\ \ \_\ \_\ # \/_/ \/_/ \/_/ \/_____/ \/_/ \/_/ \/_/ \/_/\/_/ # Adds a mysql user, and creates a database with the same name as the user and echos the generated password if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then -
nateflink revised this gist
Jun 16, 2013 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,4 @@ #!/bin/bash # __ __ ______ __ __ __ __ __ __ # /\ "-.\ \ /\ ___\ /\ \ /\ \ /\ "-.\ \ /\ \/ / # \ \ \-. \ \ \ __\ \ \ \____ \ \ \ \ \ \-. \ \ \ _"-. -
nateflink revised this gist
Jun 16, 2013 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -8,8 +8,6 @@ # \/_/ \/_/ \/_/ \/_____/ \/_/ \/_/ \/_/ \/_/\/_/ # Adds a mysql user, and creates a database with the same name as the user and echos the generated password if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then -
nateflink revised this gist
Jun 16, 2013 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,15 @@ #!/bin/bash # __ __ ______ __ __ __ __ __ __ # /\ "-.\ \ /\ ___\ /\ \ /\ \ /\ "-.\ \ /\ \/ / # \ \ \-. \ \ \ __\ \ \ \____ \ \ \ \ \ \-. \ \ \ _"-. # \ \_\\"\_\ \ \_\ \ \_____\ \ \_\ \ \_\\"\_\ \ \_\ \_\ # \/_/ \/_/ \/_/ \/_____/ \/_/ \/_/ \/_/ \/_/\/_/ # Adds a mysql user, and creates a database with the same name as the user and echos the generated password if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then -
nateflink revised this gist
Jun 14, 2013 . 1 changed file with 7 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,19 @@ #!/bin/bash # Adds a mysql user, and creates a database with the same name as the user and echos the generated password if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then echo "usage: ./$0 [mysql db username] [mysql user password] [new identifier] [optional password]" exit fi DB_PASSWORD=$(env LC_CTYPE=C tr -dc "a-zA-Z0-9-_\$\?" < /dev/urandom | head -c 16) DB_USER=$3 if [ -n "$4" ]; then DB_PASSWORD=$4 fi #sql for creating a user and a database CMD=$(cat <<EOF @@ -20,7 +23,6 @@ CREATE DATABASE IF NOT EXISTS \`$DB_USER\`; GRANT ALL PRIVILEGES ON \`$DB_USER\` . * TO '$DB_USER'@'%'; EOF ) mysql -u "$1" -p"$2" -e "$CMD" echo "$DB_PASSWORD" -
nateflink revised this gist
Jun 14, 2013 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,7 @@ if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then echo "usage: ./$0 [mysql db username] [mysql user password] [new identifier]" exit fi DB_USER=$3 -
nateflink created this gist
Jun 14, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ #!/bin/bash # Adds a mysql user, and creates a database with the same name as the user and echos the generated password # usage: if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then echo "usage: ./$0 [mysql db username] [mysql user password] [new identifier]" fi DB_USER=$3 DB_PASSWORD=</dev/urandom LC_CTYPE=C tr -dc A-Za-z0-9_\!\@\#\%\^\&\*\(\)-+ | head -c 24 #sql for creating a user and a database CMD=$(cat <<EOF CREATE USER '$DB_USER'@'%' IDENTIFIED BY '$DB_PASSWORD'; GRANT USAGE ON * . * TO '$DB_USER'@'%' IDENTIFIED BY '$DB_PASSWORD' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; CREATE DATABASE IF NOT EXISTS \`$DB_USER\`; GRANT ALL PRIVILEGES ON \`$DB_USER\` . * TO '$DB_USER'@'%'; EOF ) #echo "$CMD" > "$TMP_FILE" mysql -u "$1" -p"$2" -e "$CMD" echo "$DB_PASSWORD"