I am new to rails and i am facing alot of problems while running the project on local host using mysql database .Is there any way to run a project on sqlite3 on local host and on server it can be run using mysql database.
Asked
Active
Viewed 110 times
1 Answers
0
Yes, you can. In fact, I believe this setup is pretty common.
In your Gemfile, use sqlite3
in the development group, and mysql2
in the production group. For example,
group :production do
gem 'mysql2'
end
group :development, :test do
gem 'sqlite3'
end
Then, on your development machine, use
$ gem install --without production
to avoid installing mysql. Finally, in database.yml
, check that the sqlite adapter is selected for test and development, and the mysql adapter is selected for production.
development:
adapter: sqlite3
database: db/development.sqlite3
test:
adapter: sqlite3
database: db/test.sqlite3
production:
adapter: mysql2
encoding: utf8
This should be enough to get you started.

James Lim
- 12,915
- 4
- 40
- 65
-
I performed all the steps suggested by you and now on starting the server it is giving the error rvm/gems/ruby-1.9.3-p448/gems/eventmachine-1.0.3/lib/eventmachine.rb:526:in `start_tcp_server': no acceptor (port is in use or requires root privileges) (RuntimeError) this please help. – Ishan Sharma Sep 13 '13 at 05:08
-
You need to stop your previously running application server. – Tim Dorr Sep 13 '13 at 05:34
-
Tim there were no server running previously, I am not able to get why this error is arising each time i m trying to run the server. – Ishan Sharma Sep 13 '13 at 05:55
-
server is running now refer this link [link](http://stackoverflow.com/questions/9605430/thin-web-server-start-tcp-server-no-acceptor-runtimeerror-after-git-branch) – Ishan Sharma Sep 13 '13 at 06:40