Reputation: 31
Im using mysql in my windows7 for a year and its working fine. I recently know about django and trying to catch up the tutorials. I'm having a problem to set up the setting.py and I think its on 'NAME' path.
DATABASES =
{
'default':
{
'ENGINE': 'django.db.backends.mysql',
'NAME': os.path.join('C:/ProgramData/MySQL/MySQL Server
5.7/Data/mysql', 'db.frm'),
'USER': '***',
'PASSWORD':'***'
}
}
Upvotes: 0
Views: 3959
Reputation: 266
Try the following:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'PUT THE DATABASE NAME HERE',
'USER': 'PUT THE USER NAME',
'PASSWORD': 'PUT THE PASSWORD OF THE USERNAME ABOVE',
'HOST': 'localhost or hostname/IP of the database server',
'PORT': PORT NUMBER OF THE SERVER,
}
}
You don't need to put the path of any database file, just specify the hostname, port, username and password - and Django will connect to it
Upvotes: 2
Reputation: 173
You just need to put the name of the database.
Example:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'DB NAME',
'USER': 'USER NAME',
'PASSWORD':'USER PW',
}
}
With that, it should work.
Upvotes: 3