简体   繁体   中英

How do I connect MySQL to my Django Project

I have a Django app with running on the default sqlite3 database, but I want to connect it to a MySQL database. I have created a database in my cpanel host and configured the settings in my Django app settings as follows:

'ENGINE': 'django.db.backends.mysql',
'NAME': 'my_db_name',
'USER': 'my_username',
'PASSWORD': 'my_db_user_password',
'HOST': 'my_domain',
'PORT': '3306',

This is the response I get when I try to run my app with the settings above:

django.db.utils.OperationalError: (1045, "Access denied for user 'my_username'@'a_certain_IP' (using password: YES)")

This certain_IP is not my host Shared IP Address . I am not good with SQL, I need help please. Is there anywhere I need to set to allow password login?

Your port should be integer. If that doesn't work double check your credentials

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM