I'm using an Azure Virtual Machine with ubuntu server.
I ssh into the machine and installed a lamp server (and also phpmyadmin, so i can view via browser my databases and execute operations).
My django project is running on my macbook.
I tried to connect to the mysql database installed on the VM in django using the method explained both in documentation and other stackoverflow questions, but none of them are working.
Let's say 1.2.3.4 is my VM IP.
settings.py
DATABASES = {
# mysql
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'DBname',
'USER': 'rootuser',
'PASSWORD': 'rootPassword',
'HOST': '1.2.3.4',
},
}
Output of python manage.py runserver:
django.db.utils.OperationalError:
(2003, "Can't connect to MySQL server on '1.2.3.4' (timed out)")
Do I need to configure the mysql database? Isn't 1.2.3.4 the same IP that I need to use for the db connection?
Also when I try to install mysqlclient with pip install mysqlclient it raises an error:
Command "python setup.py egg_info" failed with error code 1
in /private/var/folders/st/8qzvdtwx6xsc1w1ffqd2c7br0000gn/T/pip-install-p25gukfh/mysqlclient/