Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. namespace :deploy do
  2.  
  3. desc "Create database and database user"
  4. task :create_mysql_database do
  5. ask :db_root_password, ''
  6. ask :db_name, ''
  7. ask :db_user, ''
  8. ask :db_pass, ''
  9.  
  10. on roles(:web) do |host|
  11. execute "mysql --user=root --password=#{fetch(:db_root_password)} -e \"CREATE DATABASE IF NOT EXISTS #{fetch(:db_name)}\""
  12. 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\""
  13. end
  14. end
  15.  
  16. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement