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
Answer a question...

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