Hi. So i was running the command tutor local do init
and it shows an error ‘MySQLdb.OperationalError: (2005, “Unknown MySQL server host ‘mysql’ (-3)”)’
Full log:
Traceback (most recent call last):
File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
self.connect()
File "/openedx/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
return func(*args, **kwargs)
File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect
self.connection = self.get_new_connection(conn_params)
File "/openedx/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
return func(*args, **kwargs)
File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 234, in get_new_connection
connection = Database.connect(**conn_params)
File "/openedx/venv/lib/python3.8/site-packages/MySQLdb/__init__.py", line 123, in Connect
return Connection(*args, **kwargs)
File "/openedx/venv/lib/python3.8/site-packages/MySQLdb/connections.py", line 185, in __init__
super().__init__(*args, **kwargs2)
MySQLdb.OperationalError: (2005, "Unknown MySQL server host 'mysql' (-3)")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./manage.py", line 106, in <module>
execute_from_command_line([sys.argv[0]] + django_args)
File "/openedx/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/openedx/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/openedx/venv/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/openedx/venv/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/openedx/venv/lib/python3.8/site-packages/django/core/management/base.py", line 89, in wrapped
res = handle_func(*args, **kwargs)
File "/openedx/venv/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 75, in handle
self.check(databases=[database])
File "/openedx/venv/lib/python3.8/site-packages/django/core/management/base.py", line 419, in check
all_issues = checks.run_checks(
File "/openedx/venv/lib/python3.8/site-packages/django/core/checks/registry.py", line 76, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/openedx/venv/lib/python3.8/site-packages/django/core/checks/database.py", line 13, in check_database_backends
issues.extend(conn.validation.check(**kwargs))
File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/mysql/validation.py", line 9, in check
issues.extend(self._check_sql_mode(**kwargs))
File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/mysql/validation.py", line 13, in _check_sql_mode
if not (self.connection.sql_mode & {'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES'}):
File "/openedx/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 405, in sql_mode
sql_mode = self.mysql_server_data['sql_mode']
File "/openedx/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 366, in mysql_server_data
with self.temporary_connection() as cursor:
File "/opt/pyenv/versions/3.8.15/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 603, in temporary_connection
with self.cursor() as cursor:
File "/openedx/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
return func(*args, **kwargs)
File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 259, in cursor
return self._cursor()
File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 235, in _cursor
self.ensure_connection()
File "/openedx/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
return func(*args, **kwargs)
File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
self.connect()
File "/openedx/venv/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
self.connect()
File "/openedx/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
return func(*args, **kwargs)
File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect
self.connection = self.get_new_connection(conn_params)
File "/openedx/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
return func(*args, **kwargs)
File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 234, in get_new_connection
connection = Database.connect(**conn_params)
File "/openedx/venv/lib/python3.8/site-packages/MySQLdb/__init__.py", line 123, in Connect
return Connection(*args, **kwargs)
File "/openedx/venv/lib/python3.8/site-packages/MySQLdb/connections.py", line 185, in __init__
super().__init__(*args, **kwargs2)
django.db.utils.OperationalError: (2005, "Unknown MySQL server host 'mysql' (-3)")
Do you know a solution to this?