Question

Can't attach an existing database to my Laravel app and can't add database env variables

Hi, Every time I try to add database env variables and save them or try to attach an existing mysql db cluster to my Laravel app I get the following error:

error validating databases field "databases.cluster_name": database cluster (app-05a5d26c-501c-4c4c-8921-32d57a9d2145)

Submit an answer


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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

In order to be able to use those environment variables, you would first need to attach your Managed MySQL database clsuter to your app. Can you confirm if you’ve done this already?

If not, in the Apps section of the DigitalOcean Control Panel, click your app, then click the Create dropdown. Add a database resource by choosing the Create/Attach Database option. If you already have a database cluster, you can attach it to your app.

After that, based on the name that you’ve specified, you will be able to access your database env details using the db.USERNAME, db.PASSWORD, etc. syntax.

Let me know how it goes!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel