Created
December 2, 2008 16:39
-
-
Save queso/31161 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'mysql' | |
require 'highline/import' | |
database = ARGV[0] + "_production" | |
username = ARGV[0] + "_dba" | |
password = ask("Enter the password for the new database: ") { |q| q.echo = "*" } | |
root_password = ask("Enter your root database password: ") { |q| q.echo = "*" } | |
db = Mysql.real_connect("localhost", "root", root_password) | |
db.query("CREATE DATABASE #{database}") | |
db.query("GRANT ALL PRIVILEGES ON #{database}.* TO '#{username}'@'%' IDENTIFIED BY '#{password}'") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment