53π
'NAME'
is the name of your database. With MySQL, you need to manually create your database too. Letβs say, if you run:
$ mysql -u root -p
mysql> CREATE DATABASE mydb;
Query OK, 1 row affected (0.02 sec)
your configuration should be:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mydb',
'USER': 'root',
'PASSWORD': 'sp153426',
'HOST': '127.0.0.1',
'PORT': '3306',
}
}
0π
Hey man it just required that the database should already be created in MySQL.
- [Django]-How to create objects on the fly in python?
- [Django]-How to clear form fields after a submit in Django
- [Django]-Access tuple in django template
0π
I use docker to start mysql.
I changed the database name, then have same error.
After remove dockerβs volume cache, thing be ok!
docker volume --help
docker volume ls
docker volume rm xx yy
- [Django]-Django model CharField: max_length does not work?
- [Django]-Django access the length of a list within a template
- [Django]-ImportError: No module named django_filters
0π
First you need to create database in Mysql database with the name which you write in your settings.py in mysql connectivuty code
settings.py
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'name_of database', 'USER': 'root', 'PASSWORD': 'sp153426', 'HOST': '127.0.0.1', 'PORT': '3306', } }
here name_of_database β is needed already in your database
create with sql query
`CREATE DATABASE name_of Database;`
- [Django]-What are the best practices for testing "different layers" in Django?
- [Django]-How to discriminate based on HTTP method in django urlpatterns
- [Django]-Django rest framework: query parameters in detail_route