Getting a strange error. I created a database in MySQL, set the database to use it. Using the right settings in my Django settings.py. But still there's an error that no database has been selected.
First I tried:
python manage.py syncdb
Got this traceback:
django.db.utils.OperationalError: (1046, 'No database selected')
settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'my_db',
'USER': 'username',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '3306',
}
}
What have I missed?
Check to make sure your database my_db exists in your MySQL instance. Log into MySQL and run;
show databases;
make sure my_db exists. If it does not, run
create database my_db;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With