By Neil Smith
I’m trying to set-up my first application using the App Platform - it’s a Ruby on Rails application that I’m trying to link to an existing MySQL database.
The default behaviour sets a DATABASE_URL environment variable with the correct connection string - it begins mysql://
However, in Ruby on Rails, this tries to use the older “mysql” gem, instead of the “mysql2” gem. (The older gem isn’t compiling for me.)
I believe this would work if DATABASE_URL began with mysql2:// - but I can’t seem to find any way to change that protocol.
I suspect I could remove the environment variable and configure all the parameters manually, but this seems a shame when the built-in behaviour is so very close to what I need!
Any advice warmly received - many thanks!
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!
Hi there,
As this is an already existing MySQL cluster, what you could do is define a new environment variable with the correct connection string:
DATABASE_URL_MYSQL2 = mysql2://your_cluster_details
That way you can use have better control over the environment variable and the protocol defined.
Let me know how it goes!
Best,
Bobby
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.
From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.