# Database in Azure

We will now see how to connect to a database that's not running locally on your laptop, but in the cloud instead.

First of all, follow all steps on Azure database hosting.

Once you have requested your Azure student credit, set up your MySQL database on Azure and connected to that database in MySQL Workbench, you're good to go and continue here.

To make your backend in Python connect with your database on Azure, we only need to change the variables declared in the .env file. The values shown below are just dummy values, replace them by the correct ones for your Azure environment.

DB_USERNAME=demoadmin
DB_PASSWORD=whateverYourPasswordIs
DB_HOSTNAME=AzureHostname
1
2
3

TIP

In case you don't remember what the hostname, username and password of your Azure database are, click on 'Connect' in the left-side menu on Azure. The hostname and username can be found there.

Azure connection details

Connecting at school

Whenever you're at school, make sure to connect to a network different than eduroam. The firewall settings of eduroam will probably block your access to the database. On the TM_Intern network, it should work.

Last Updated: 2/20/2024, 11:03:02 AM