kristen kristen - 1 year ago 84
MySQL Question

Connect Django to remote mysql server on a local network

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: (aka "laptop")
Remote is: (aka "desktop") looks like this:

'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mydb',
'USER': 'root',
'PASSWORD': 'mypass',
'HOST': '',
'PORT': '3306',

I run 'python 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?

Answer Source

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.