aircraft aircraft - 1 month ago 21
MySQL Question

How to test connect the MySQL in Django?

In the Django project's

settings.py
, there is the DATABASES config:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'csvt',
'USER':'root',
'PASSWORD':'123456',
'HOST':'127.0.0.1',
'PORT':'3306',
}
}


Now, I even don't know the password if is correct, how can I test the connect with my MySQL on my Mac?

Answer Source

you can try testing when creating migrations or creating admin user.

run this on terminal. On your django root folder.

python manage.py createsuperuser

If you are able to create a super user. Then you can access your Django Admin page. in http://your_base_url/admin