What I tried:
- Installed the MySql server on the EC2 instance.
- In the security group of the instance added an inbound rule to connect over shh from all source
- Created a database and user
- Given that user all permissions using
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
- Created a Django project using
django-admin startproject mysite
and installed mysqlclient - in project settings, I changed the default database from SQLite to
{
'ENGINE': 'django.db.backends.mysql',
'NAME': 'dbtest',
'USER': 'root',
'HOST': '{IPv4 Public IP of the Instance}',
'PASSWORD': 'password',
}
Now when I run python manage.py runserver
it gives me the error
django.db.utils.OperationalError: (1045, "Access denied for user 'root'@'xxx.xx.xxx.xxx' (using password: YES)")
Then I granted all privileges to this specific IP as well using: GRANT ALL PRIVILEGES ON *.* TO 'root'@'xxx.xx.xxx.xxx' WITH GRANT OPTION;
Still no luck.Same Error.