Connecting Django to a remote mysql server on a local network

I have Django installed and I am full newb. I successfully connected to the mysql database on my localhost, but I had problems connecting to the database hosted on another machine on the local network.

Local address: 192.168.1.51 (aka β€œlaptop”) Remote access: 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 runningerver" and get an error:

_mysql_exceptions.OperationalError: (1045, "Access denied for user 'root'@'laptop.local' (using password: YES)")

I granted access to "root @laptop", but I can not understand why it adds ".local". Am I doing it right?

+7
source share
1 answer

By default, the root account can only be used to log into mysql locally. First, you must provide the user with user logon rights.

+1
source

All Articles