fix: Be able to connect to SQL in containers from CMS
By default if you use `localhost` as the `HOST` value for mysql, it tries to connect to a file socket on disk rather than trying to connect to the loopback hostname. This prevents us from running MySQL in a container while running the LMS on your local machine. Setting the host to `127.0.0.1` forces the SQL connection to go over TCP instead. This allows you to map your container port to your localhost without any issues. We did this in lms/envs/common.py in an earlier change but did not update cms/envs/common.py at that time.
This commit is contained in:
@@ -1052,7 +1052,7 @@ DATABASES = {
|
||||
'ATOMIC_REQUESTS': True,
|
||||
'CONN_MAX_AGE': 0,
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'HOST': 'localhost',
|
||||
'HOST': '127.0.0.1',
|
||||
'NAME': 'edxapp',
|
||||
'OPTIONS': {},
|
||||
'PASSWORD': 'password',
|
||||
@@ -1062,7 +1062,7 @@ DATABASES = {
|
||||
'read_replica': {
|
||||
'CONN_MAX_AGE': 0,
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'HOST': 'localhost',
|
||||
'HOST': '127.0.0.1',
|
||||
'NAME': 'edxapp',
|
||||
'OPTIONS': {},
|
||||
'PASSWORD': 'password',
|
||||
@@ -1072,7 +1072,7 @@ DATABASES = {
|
||||
'student_module_history': {
|
||||
'CONN_MAX_AGE': 0,
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'HOST': 'localhost',
|
||||
'HOST': '127.0.0.1',
|
||||
'NAME': 'edxapp_csmh',
|
||||
'OPTIONS': {},
|
||||
'PASSWORD': 'password',
|
||||
|
||||
Reference in New Issue
Block a user