Created
August 16, 2011 14:45
-
-
Save alexrinass/1149248 to your computer and use it in GitHub Desktop.
Create new MySQL database
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/sh | |
DB="$1" | |
if [ -z "$DB" ]; then | |
echo "Usage: addmysqldb DB" | |
exit 0 | |
fi | |
RESULT=$(echo "CREATE DATABASE \`$DB\` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" |mysql5 mysql 2>&1) | |
if [ $? > 0 ]; then | |
echo "$RESULT" | |
exit 1 | |
fi | |
echo "Created database '$DB' with UTF-8 character set." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment