1

How may i change my database from MYSQL to Sql server in Rails 4

 What configuration i may specify in database.yml file and what all gem i may need to add for that.Please help. :)
Hardik Upadhyay
  • 2,639
  • 1
  • 19
  • 34
Mahesh Sharma
  • 221
  • 1
  • 13

1 Answers1

0

Add this to gemfile

gem install mysql2

And this to database.yml

default: &default
  adapter: mysql2
  encoding: utf8
  host: 127.0.0.1
  port: 3306

development:
  <<: *default
  database: development_db_name
  username: YOUR_USER_NAME
  password: YOUR_PASSWORD 

test:
  <<: *default
  database: test_db_name
  username: YOUR_USER_NAME
  password: YOUR_PASSWORD

production:
  <<: *default
  database: production_db_name
  username: YOUR_USER_NAME
  password: YOUR_PASSWORD
Hardik Upadhyay
  • 2,639
  • 1
  • 19
  • 34
  • Mysql2 is already installed,only problem is i have created dump file of database using mysql2 database.Now i changed my database from mysql to sqlserver.Now i want to restore that .sql dump file to sql server database.But how may i do it.....coz source dump_file_name.sql is an mysql command for restoring....but now i want to restore that dump file in sql server database....then how its possible?????? please let me know.......!!!! – Mahesh Sharma Apr 04 '17 at 09:18
  • my previous a/c is suspended.....you helped me in this question......http://stackoverflow.com/questions/43061570/strftime-error-while-switching-my-database-from-sqlite3-to-mysql-in-rails4....u remembered?????? – Mahesh Sharma Apr 04 '17 at 09:27