Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace :deploy do
- desc "Create database and database user"
- task :create_mysql_database do
- ask :db_root_password, ''
- ask :db_name, ''
- ask :db_user, ''
- ask :db_pass, ''
- on roles(:web) do |host|
- execute "mysql --user=root --password=#{fetch(:db_root_password)} -e \"CREATE DATABASE IF NOT EXISTS #{fetch(:db_name)}\""
- execute "mysql --user=root --password=#{fetch(:db_root_password)} -e \"GRANT ALL PRIVILEGES ON #{fetch(:db_name)}.* TO '#{fetch(:db_user)}'@'localhost' IDENTIFIED BY '#{fetch(:db_pass)}' WITH GRANT OPTION\""
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement