Last active
August 29, 2015 14:22
-
-
Save voor/c08864797a4337c10106 to your computer and use it in GitHub Desktop.
Create MySQL Database and User
This file contains 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
# Adopted from http://jetpackweb.com/blog/2009/07/20/bash-script-to-create-mysql-database-and-user/ | |
# Replace $mysqlroot with root password | |
# Replace $dbname with database name | |
# Replace $dbuser with database user | |
# Replace $dbpasswd with password | |
mysql -u root -p$mysqlroot <<-EOF | |
CREATE DATABASE $dbname; | |
GRANT ALL PRIVILEGES ON $database.* TO '$dbuser'@'localhost' \ | |
IDENTIFIED BY '$dbpasswd'; | |
FLUSH PRIVILEGES; | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment