is there a way to drop and re-create a database from within a ruby script? Which gem (dbi, mysql2) should I use?
With DBI I have the problem that I cannot connect to the MySQL server when the database has not yet been created.
Thank you
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
mysql2 will work, have a look at the rake tasks that come with rails db:create etc
EDIT :
Rails rake tasks to create / drop DBs
https://github.com/rails/rails/blob/master/activerecord/lib/active_record/railties/databases.rake