Leman Kirme
Leman Kirme

Reputation: 550

Connect Django to MySql database on VPS

I am trying to run my Django project on a VPS. My Django project uses MySQL. While running it on my local computer I used the following code to connect MySQL to Django

 DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.mysql',
    'NAME': 'db_name',
    'USER': 'root',
    'PASSWORD': 'password',
    'HOST': 'localhost',
    'PORT': 3306}
}

What must be the 'USER','HOST','PORT' here while connecting to MySQL?

Upvotes: 0

Views: 293

Answers (1)

Matt Seymour
Matt Seymour

Reputation: 9415

If you are running the mysql server on the same machine as the vps then most likely your connection details will remain the same. The only difference being the username and the password.

If you need help installing mysql checkout this tutorial on digital ocean for basic steps to get you pointed in the right direction.

If you are using a cloud sql solution the connection details will be present in the sql control pane for the solution you are using.

Upvotes: 0

Related Questions