Question

How to make my mysql dbase working

Hello, It’s my first time deploying a project so there are many things I dunno how to do. In detail I’ve a Laravel/Docker/GraphQL connected to mysql database that work perfectly in local. It is connected to two Vue.js projects that work as frontend and backend. Yesterday I deployed all the projects (Laravel + Vue.js) but at the moment I don’t know how to do make the database working. Should I change my .env file on Laravel? In case, how? Should I create a database on DigitalOcean and somehow connect it my code? In case, how? I apologize if the questions are stupid but as I said I’m newbie in deploying and I don’t know how to do things.

Thank you for your help Valerio


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.

KFSys
Site Moderator
Site Moderator badge
November 17, 2022

Hi @8f0e7f4152d640ae9e71b26f202a0,

There are two ways to go about the problem.

One, you can install MySQL on your Droplet, add the connection in your env file OR use DigitalOcean Managed Databases and again update your env file to match those links.

Here is a link to the Managed Database section:

https://www.digitalocean.com/products/managed-databases

With the Docs being here:

https://docs.digitalocean.com/products/databases/

and how to connect your Droplet to your Managed Database here:

https://docs.digitalocean.com/products/databases/mysql/how-to/connect/

If you want to use the First option, you’ll need to install MySQL and configure a DB user which then you can use to connect from your Laravel App:

https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql

Lastly, I just remember that you can use the Laravel MarketPlace Droplet that comes pre-installed with everything you need:

https://marketplace.digitalocean.com/apps/laravel

Try DigitalOcean for free

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

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

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

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
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
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.

© 2023 DigitalOcean, LLC.