user2162428
user2162428

Reputation: 33

How to set django database settings

I am new to django. I need to use mysql database. I also need to specify the host, username, password..etc I tried to change my .settings file but it is not working

DATABASES = {
'default': {
    'ENGINE': 'mysql',
    'NAME': 'database',                      
    'USER': 'root',
    'PASSWORD': 'passwd',
    'HOST': 'localhost',                      
    'PORT': '',
}
}

Upvotes: 3

Views: 145

Answers (2)

leet
leet

Reputation: 961

Its django.db.backends.mysql not just mysql

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

Upvotes: 4

Carlos
Carlos

Reputation: 4637

What you need to use is the backend module connection

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.mysql',
    'NAME': 'yourdatabase',
    'USER': 'yourusername',
    'PASSWORD': 'yourpassword',
    'HOST': 'localhost',                      
    'PORT': '',
}

Upvotes: 0

Related Questions