Skip to content

Instantly share code, notes, and snippets.

@take
Created January 3, 2013 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save take/4442690 to your computer and use it in GitHub Desktop.
Save take/4442690 to your computer and use it in GitHub Desktop.
database.yml mysql adapter
<%
socket = ["/tmp/mysqld.sock",
"/tmp/mysql.sock",
"/var/run/mysqld/mysqld.sock",
"/var/lib/mysql/mysql.sock",
"/opt/local/var/run/mysql5/mysqld.sock"
].detect{|socket| File.exist?(socket)}
%>
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: db_development
pool: 5
username: root
password:
socket: <%= socket %>
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
encoding: utf8
reconnect: false
database: db_test
pool: 5
username: root
password:
socket: <%= socket %>
production:
adapter: mysql2
encoding: utf8
reconnect: false
host:
database:
pool: 5
username:
password:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment