Reputation: 41949
I've been making Rails sites with sqlite3 on my local host, but I also have mysql installed in two places, both with MAMP and on its own on my hard drive. Using sqlite3 is easy because you have to do nothing, but, due to a gem that I wish to use http://www.enkiblog.com/ (which says it requires mysql or postgres) I have to leave the easy world of sqlite3 for now. So I have to do some configuration to specify which mysql on my system my next Rails app will use, and how would I do that? I don't want to use the MAMP mysql.
Thanks
Upvotes: 0
Views: 55
Reputation: 230346
Update your database.yml
to something like this:
development:
adapter: mysql
encoding: utf8
database: yourdb_development
username: root
password:
socket: /tmp/mysql.sock
Notice the socket
parameter? You can set up your two MySQL servers to use different sockets and here you specify which one you want to use.
Add configuration for test
and production
environments in a similar manner.
You can specify location of socket file in a MySQL's config file (usually named my.cnf
), like this:
[mysqld]
socket=/path/to/socket
[client]
socket=/path/to/socket
See this page for more information. Where to find config files on your machine - that's out of scope of this question. :-)
Upvotes: 2
Reputation: 10004
The enki gem supports sqlite3, they even use it in their default config example. They just mention only mysql and postgres in the readme.
IMO a gem not supporting sqlite3 would be a huge red flag.
https://github.com/xaviershay/enki/blob/master/config/database.example.yml
Upvotes: 0