This repository has been archived by the owner on Apr 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
MySQL
Ross Allen edited this page Jan 21, 2015
·
6 revisions
production:
adapter: mysql
database: 'your_database_name_here'
username: 'mysql_username'
password: 'password'
port: '3306'
ssl: {ca_cert: 'path_to_ca_cert'}
# valid ssl options are [cipher,ca_path,ca_cert,client_cert,client_key]
# as tested only ca_cert was required to connect to RDS
# you may need to grab the cert from here: https://rds.amazonaws.com/doc/mysql-ssl-ca-cert.pem
In order to connect to a server with SSL, the DataMapper setup must be given an :ssl
option containing a hash of ssl information. For example, let's say you had the following connection:
DataMapper.setup(:default,
:adapter => 'mysql',
:user => 'user-ssl',
:password => 'password',
:host => 'secure.science.org',
:database => 'experiments')
The only thing required to connect to the server is to add the hash of ssl configuration:
DataMapper.setup(:default,
:adapter => 'mysql',
:user => 'user-ssl',
:password => 'password',
:host => 'secure.science.org',
:database => 'experiments',
:ssl => {
:ca_cert => '/etc/mysql/ssl/ca-cert.pem',
:client_key => '/etc/mysql/ssl/client-key.pem',
:client_cert => '/etc/mysql/ssl/client-cert.pem'}
)
)
Note: the :ssl_ca
, :client_key
, and :client_cert
are all required. Optionally, two other hash parameters are also avaliable: :ca_path
and :cipher
.