I have setup Django and am a complete newb. I have successfully connected to a mysql database on my localhost but have had trouble connecting to a database that’s hosted on another machine on my local network.
Localhost is: 192.168.1.51 (aka “laptop”)
Remote is: 192.168.1.50 (aka “desktop”)
settings.py looks like this:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mydb',
'USER': 'root',
'PASSWORD': 'mypass',
'HOST': '192.168.1.50',
'PORT': '3306',
}
}
I run ‘python manage.py runserver’ and get an error:
_mysql_exceptions.OperationalError: (1045, “Access denied for user ‘root’@’laptop.local’ (using password: YES)”)
I’ve granted access to ‘root@laptop’ but I can’t figure out why it is adding ‘.local’….Am I doing this right?
In default, root account only can be used to login to mysql locally. You need give root user logon permission from the host at first.