MySQLdb.OperationalError: (2005, "Unknown MySQL server host 'mysql' (-3)")

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?

What are the logs coming out of the mysql container? tutor local logs --tail=100 mysql

  Failed to enable plugin 'mfe': plugin 'mfe' is not installed.
⚠️  You are running Tutor as root. This is strongly not recommended. If you are doing this in order to access the Docker daemon, you should instead add your user to the 'docker' group. (see https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user)
docker compose -f /root/.local/share/tutor/env/local/docker-compose.yml -f /root/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local logs --tail 100 mysql
tutor_local-mysql-1  | 2023-06-29T01:53:00.621828Z 0 [ERROR] [MY-010119] [Server] Aborting
tutor_local-mysql-1  | 2023-06-29T01:53:00.622469Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.33)  MySQL Community Server - GPL.
tutor_local-mysql-1  | 2023-06-29 01:53:01+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.33-1.el8 started.
tutor_local-mysql-1  | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
tutor_local-mysql-1  | 2023-06-29T01:53:01.371431Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
tutor_local-mysql-1  | 2023-06-29T01:53:01.372208Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.33) starting as process 1
tutor_local-mysql-1  | 2023-06-29T01:53:01.372731Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
tutor_local-mysql-1  | 2023-06-29T01:53:01.372735Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8mb3_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
tutor_local-mysql-1  | 2023-06-29T01:53:01.380500Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
tutor_local-mysql-1  | 2023-06-29T01:53:01.457673Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
tutor_local-mysql-1  | 2023-06-29T01:53:02.457900Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
tutor_local-mysql-1  | 2023-06-29T01:53:03.458147Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
tutor_local-mysql-1  | 2023-06-29T01:53:04.458328Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
tutor_local-mysql-1  | 2023-06-29T01:53:05.458531Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
tutor_local-mysql-1  | 2023-06-29T01:53:06.458727Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
tutor_local-mysql-1  | 2023-06-29T01:53:07.458936Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
tutor_local-mysql-1  | 2023-06-29T01:53:08.459095Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
tutor_local-mysql-1  | 2023-06-29T01:53:09.459254Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
tutor_local-mysql-1  | 2023-06-29T01:53:10.459422Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
tutor_local-mysql-1  | 2023-06-29T01:53:11.459595Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
tutor_local-mysql-1  | 2023-06-29T01:53:12.459751Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
tutor_local-mysql-1  | 2023-06-29 02:03:06+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.33-1.el8 started.
tutor_local-mysql-1  | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
tutor_local-mysql-1  | 2023-06-29T02:03:06.914131Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
tutor_local-mysql-1  | 2023-06-29T02:03:06.915070Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.33) starting as process 1
tutor_local-mysql-1  | 2023-06-29T02:03:06.915636Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
tutor_local-mysql-1  | 2023-06-29T02:03:06.915640Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8mb3_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
tutor_local-mysql-1  | 2023-06-29T02:03:06.918711Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
tutor_local-mysql-1  | 2023-06-29T02:03:07.043787Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
tutor_local-mysql-1  | 2023-06-29T02:03:07.204458Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
tutor_local-mysql-1  | 2023-06-29T02:03:07.204478Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
tutor_local-mysql-1  | 2023-06-29T02:03:07.205379Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
tutor_local-mysql-1  | 2023-06-29T02:03:07.218675Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
tutor_local-mysql-1  | 2023-06-29T02:03:07.218690Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.33'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
tutor_local-mysql-1  | 2023-06-29T02:03:09.415132Z 10 [Warning] [MY-010235] [Server] Following users were specified in CREATE USER IF NOT EXISTS but they already exist. Corresponding entry in binary log used default authentication plugin 'caching_sha2_password' to rewrite authentication information (if any) for them: 'openedx'@'%'
tutor_local-mysql-1  | 2023-06-29T02:04:32.720538Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.33).
tutor_local-mysql-1  | 2023-06-29T02:04:33.667971Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.33)  MySQL Community Server - GPL.
tutor_local-mysql-1  | 2023-06-29 03:44:26+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.33-1.el8 started.
tutor_local-mysql-1  | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
tutor_local-mysql-1  | 2023-06-29T03:44:26.588841Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
tutor_local-mysql-1  | 2023-06-29T03:44:26.589598Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.33) starting as process 1
tutor_local-mysql-1  | 2023-06-29T03:44:26.590139Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
tutor_local-mysql-1  | 2023-06-29T03:44:26.590143Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8mb3_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
tutor_local-mysql-1  | 2023-06-29T03:44:26.593315Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
tutor_local-mysql-1  | 2023-06-29T03:44:26.723906Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
tutor_local-mysql-1  | 2023-06-29T03:44:26.874537Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
tutor_local-mysql-1  | 2023-06-29T03:44:26.874554Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
tutor_local-mysql-1  | 2023-06-29T03:44:26.875559Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
tutor_local-mysql-1  | 2023-06-29T03:44:26.886634Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.33'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
tutor_local-mysql-1  | 2023-06-29T03:44:26.886659Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
tutor_local-mysql-1  | 2023-06-29T03:45:57.263212Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.33).
tutor_local-mysql-1  | 2023-06-29T03:45:58.242284Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.33)  MySQL Community Server - GPL.
tutor_local-mysql-1  | 2023-06-29 03:45:59+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.33-1.el8 started.
tutor_local-mysql-1  | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
tutor_local-mysql-1  | 2023-06-29T03:45:59.507101Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
tutor_local-mysql-1  | 2023-06-29T03:45:59.507885Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.33) starting as process 1
tutor_local-mysql-1  | 2023-06-29T03:45:59.508409Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
tutor_local-mysql-1  | 2023-06-29T03:45:59.508413Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8mb3_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
tutor_local-mysql-1  | 2023-06-29T03:45:59.511502Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
tutor_local-mysql-1  | 2023-06-29T03:45:59.641917Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
tutor_local-mysql-1  | 2023-06-29T03:45:59.794453Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
tutor_local-mysql-1  | 2023-06-29T03:45:59.794474Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
tutor_local-mysql-1  | 2023-06-29T03:45:59.795472Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
tutor_local-mysql-1  | 2023-06-29T03:45:59.808550Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
tutor_local-mysql-1  | 2023-06-29T03:45:59.808577Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.33'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
tutor_local-mysql-1  | 2023-06-29T03:46:02.184102Z 10 [Warning] [MY-010235] [Server] Following users were specified in CREATE USER IF NOT EXISTS but they already exist. Corresponding entry in binary log used default authentication plugin 'caching_sha2_password' to rewrite authentication information (if any) for them: 'openedx'@'%'
tutor_local-mysql-1  | 2023-06-29T03:48:38.493771Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.33).
tutor_local-mysql-1  | 2023-06-29T03:48:39.278809Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.33)  MySQL Community Server - GPL.
tutor_local-mysql-1  | 2023-06-29 03:48:40+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.33-1.el8 started.
tutor_local-mysql-1  | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
tutor_local-mysql-1  | 2023-06-29T03:48:40.762362Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
tutor_local-mysql-1  | 2023-06-29T03:48:40.763233Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.33) starting as process 1
tutor_local-mysql-1  | 2023-06-29T03:48:40.763963Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
tutor_local-mysql-1  | 2023-06-29T03:48:40.763967Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8mb3_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
tutor_local-mysql-1  | 2023-06-29T03:48:40.767194Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
tutor_local-mysql-1  | 2023-06-29T03:48:40.910997Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
tutor_local-mysql-1  | 2023-06-29T03:48:41.083591Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
tutor_local-mysql-1  | 2023-06-29T03:48:41.083609Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
tutor_local-mysql-1  | 2023-06-29T03:48:41.084535Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
tutor_local-mysql-1  | 2023-06-29T03:48:41.096439Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
tutor_local-mysql-1  | 2023-06-29T03:48:41.096499Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.33'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
tutor_local-mysql-1  | 2023-06-29T03:48:43.231446Z 10 [Warning] [MY-010235] [Server] Following users were specified in CREATE USER IF NOT EXISTS but they already exist. Corresponding entry in binary log used default authentication plugin 'caching_sha2_password' to rewrite authentication information (if any) for them: 'openedx'@'%'
tutor_local-mysql-1  | 2023-06-29T04:02:17.124031Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.33).
tutor_local-mysql-1  | 2023-06-29T04:02:17.740382Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.33)  MySQL Community Server - GPL.
tutor_local-mysql-1  | 2023-06-29 04:03:17+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.33-1.el8 started.
tutor_local-mysql-1  | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
tutor_local-mysql-1  | 2023-06-29T04:03:18.035811Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
tutor_local-mysql-1  | 2023-06-29T04:03:18.036594Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.33) starting as process 1
tutor_local-mysql-1  | 2023-06-29T04:03:18.037243Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
tutor_local-mysql-1  | 2023-06-29T04:03:18.037246Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8mb3_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
tutor_local-mysql-1  | 2023-06-29T04:03:18.040567Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
tutor_local-mysql-1  | 2023-06-29T04:03:18.169611Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
tutor_local-mysql-1  | 2023-06-29T04:03:18.363318Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
tutor_local-mysql-1  | 2023-06-29T04:03:18.363338Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
tutor_local-mysql-1  | 2023-06-29T04:03:18.364472Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
tutor_local-mysql-1  | 2023-06-29T04:03:18.378174Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
tutor_local-mysql-1  | 2023-06-29T04:03:18.378217Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.33'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
tutor_local-mysql-1  | 2023-06-29T04:04:53.106025Z 16 [Warning] [MY-010235] [Server] Following users were specified in CREATE USER IF NOT EXISTS but they already exist. Corresponding entry in binary log used default authentication plugin 'caching_sha2_password' to rewrite authentication information (if any) for them: 'openedx'@'%'
tutor_local-mysql-1  | 2023-06-29T04:04:55.162928Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.33).
tutor_local-mysql-1  | 2023-06-29T04:04:55.801985Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.33)  MySQL Community Server - GPL.

Are you running tutor commands sometimes with sudo and sometimes without?

Only with sudo