By chumzp
Hi, my Ruby on Rails demo app runs well with Sqlite. I now need to use MySQL database created on my droplet. Ho would I do this. I would appreciate your support Pierre
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Generally, in order to use MySql for a Rails app there are a few steps that need to be followed. First, install MySql itself:
sudo apt-get install mysql-server
You’ll also want to create a separate user and database for your app. This tutorial will walk you through creating users in MySql:
Next, require the mysql gem in your app’s Gemfile and re-run bundle install in order to install it.
Then in your config/database.yml file, you’ll need to set the correct information for your app to be able to connect to the database. It would look something like this:
production:
adapter: mysql
encoding: utf8
database: rails_app
username: rails_user
password: pwd
host: 127.0.0.1
port: 3306
pool: 10
Hopefully, this points you in the right direction. Let us know how it goes!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.