Having problem in installing due to mysql connection lost

Hi all, I am installing the tutor and facing a connection loss error while migrating the data during the launch command below is the error details

System -MacOs m1 chip
tutor - 17.0.1

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 244, in handle
    post_migrate_state = executor.migrate(
  File "/openedx/venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 227, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/migrations/migration.py", line 126, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/migrations/operations/models.py", line 92, in database_forwards
    schema_editor.create_model(model)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 345, in create_model
    self.execute(sql, params or None)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 145, in execute
    cursor.execute(sql, params)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  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/utils.py", line 82, in _execute
    return self.cursor.execute(sql)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "/openedx/venv/lib/python3.8/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/openedx/venv/lib/python3.8/site-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/openedx/venv/lib/python3.8/site-packages/MySQLdb/connections.py", line 254, in query
    _mysql.connection.query(self, query)
django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server during query')
Error: Command failed with status 1: docker compose -f /Users/shoaibali/Library/Application Support/tutor/env/local/docker-compose.yml -f /Users/shoaibali/Library/Application Support/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /Users/shoaibali/Library/Application Support/tutor/env/local/docker-compose.jobs.yml run --rm lms-job sh -e -c dockerize -wait tcp://mysql:3306 -timeout 20s
dockerize -wait tcp://mongodb:27017 -timeout 20s

echo "Loading settings $DJANGO_SETTINGS_MODULE"

./manage.py lms migrate

# Create oauth2 apps for CMS SSO
# https://github.com/openedx/edx-platform/blob/master/docs/guides/studio_oauth.rst
./manage.py lms manage_user cms cms@openedx --unusable-password
./manage.py lms create_dot_application \
  --grant-type authorization-code \
  --redirect-uris "http://studio.local.overhang.io/complete/edx-oauth2/" \
  --client-id cms-sso \
  --client-secret YqBYvBGNewzD29vHuNL4BN70 \
  --scopes user_id \
  --skip-authorization \
  --update cms-sso cms
./manage.py lms create_dot_application \
  --grant-type authorization-code \
  --redirect-uris "http://studio.local.overhang.io:8001/complete/edx-oauth2/" \
  --client-id cms-sso-dev \
  --client-secret YqBYvBGNewzD29vHuNL4BN70 \
  --scopes user_id \
  --skip-authorization \
  --update cms-sso-dev cms


# Fix incorrect uploaded file path
if [ -d /openedx/data/uploads/ ]; then
  if [ -n "$(ls -A /openedx/data/uploads/)" ]; then
    echo "Migrating LMS uploaded files to shared directory"
    mv /openedx/data/uploads/* /openedx/media/
    rm -rf /openedx/data/uploads/
  fi
fi

# Create waffle switches to enable some features, if they have not been explicitly defined before
# Completion tracking: add green ticks to every completed unit
(./manage.py lms waffle_switch --list | grep completion.enable_completion_tracking) || ./manage.py lms waffle_switch --create completion.enable_completion_tracking on

Thanks in advance

Hi, I’m having a similar issue. When trying to deploy the Tutor package from AWS marketplace I receive an error with lost connection to MySQL:

Blockquote
local launch
Running migrations:
Applying contenttypes.0001_initial… OK
Applying auth.0001_initial… OK
Applying admin.0001_initial… OK
Applying admin.0002_logentry_remove_auto_add… OK
Applying admin.0003_logentry_add_action_flag_choices… OK
Applying agreements.0001_initial… OK
Applying announcements.0001_initial… OK
Applying sites.0001_initial… OK
Applying contenttypes.0002_remove_content_type_name… OK
Applying api_admin.0001_initial… OK
Applying api_admin.0002_auto_20160325_1604… OK
Applying api_admin.0003_auto_20160404_1618… OK
Applying api_admin.0004_auto_20160412_1506… OK
Applying api_admin.0005_auto_20160414_1232… OK
Applying api_admin.0006_catalog… OK
Applying api_admin.0007_delete_historical_api_records… OK
Applying assessment.0001_initial…Traceback (most recent call last):
File “/openedx/venv/lib/python3.8/site-packages/django/db/backends/utils.py”, line 82, in _execute
return self.cursor.execute(sql)
File “/openedx/venv/lib/python3.8/site-packages/django/db/backends/mysql/base.py”, line 73, in execute
return self.cursor.execute(query, args)
File “/openedx/venv/lib/python3.8/site-packages/MySQLdb/cursors.py”, line 206, in execute
res = self._query(query)
File “/openedx/venv/lib/python3.8/site-packages/MySQLdb/cursors.py”, line 319, in _query
db.query(q)
File “/openedx/venv/lib/python3.8/site-packages/MySQLdb/connections.py”, line 254, in query
_mysql.connection.query(self, query)
MySQLdb.OperationalError: (2013, ‘Lost connection to MySQL server during query’)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “./manage.py”, line 106, in
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 244, in handle
post_migrate_state = executor.migrate(
File “/openedx/venv/lib/python3.8/site-packages/django/db/migrations/executor.py”, line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File “/openedx/venv/lib/python3.8/site-packages/django/db/migrations/executor.py”, line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File “/openedx/venv/lib/python3.8/site-packages/django/db/migrations/executor.py”, line 232, in apply_migration
self.record_migration(migration)
File “/openedx/venv/lib/python3.8/site-packages/django/db/migrations/executor.py”, line 244, in record_migration
self.recorder.record_applied(migration.app_label, migration.name)
File “/openedx/venv/lib/python3.8/site-packages/django/db/migrations/recorder.py”, line 86, in record_applied
self.ensure_schema()
File “/openedx/venv/lib/python3.8/site-packages/django/db/migrations/recorder.py”, line 63, in ensure_schema
if self.has_table():
File “/openedx/venv/lib/python3.8/site-packages/django/db/migrations/recorder.py”, line 56, in has_table
tables = self.connection.introspection.table_names(cursor)
File “/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/introspection.py”, line 52, in table_names
return get_names(cursor)
File “/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/introspection.py”, line 47, in get_names
return sorted(ti.name for ti in self.get_table_list(cursor)
File “/openedx/venv/lib/python3.8/site-packages/django/db/backends/mysql/introspection.py”, line 69, in get_table_list
cursor.execute(“SHOW FULL TABLES”)
File “/openedx/venv/lib/python3.8/site-packages/django/db/backends/utils.py”, line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File “/openedx/venv/lib/python3.8/site-packages/django/db/backends/utils.py”, line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File “/openedx/venv/lib/python3.8/site-packages/django/db/backends/utils.py”, line 84, in _execute
return self.cursor.execute(sql, params)
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/utils.py”, line 82, in _execute
return self.cursor.execute(sql)
File “/openedx/venv/lib/python3.8/site-packages/django/db/backends/mysql/base.py”, line 73, in execute
return self.cursor.execute(query, args)
File “/openedx/venv/lib/python3.8/site-packages/MySQLdb/cursors.py”, line 206, in execute
res = self._query(query)
File “/openedx/venv/lib/python3.8/site-packages/MySQLdb/cursors.py”, line 319, in _query
db.query(q)
File “/openedx/venv/lib/python3.8/site-packages/MySQLdb/connections.py”, line 254, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (2013, ‘Lost connection to MySQL server during query’)
Error: Command failed with status 1: docker compose -f /home/tutor/.local/share/tutor/env/local/docker-compose.yml -f /home/tutor/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /home/tutor/.local/share/tutor/env/local/docker-compose.jobs.yml run --rm lms-job sh -e -c dockerize -wait tcp://mysql:3306 -timeout 20s
dockerize -wait tcp://mongodb:27017 -timeout 20s
echo “Loading settings $DJANGO_SETTINGS_MODULE”
./manage.py lms migrate
Create oauth2 apps for CMS SSO
https://github.com/openedx/edx-platform/blob/master/docs/guides/studio_oauth.rst
./manage.py lms manage_user cms cms@openedx --unusable-password
./manage.py lms create_dot_application
–grant-type authorization-code
–redirect-uris “http://studio.www.credotraining.com/complete/edx-oauth2/
–client-id cms-sso
–client-secret 25jeicQuGEiMIBgGrnO5ZwI6
–scopes user_id
–skip-authorization
–update cms-sso cms
./manage.py lms create_dot_application
–grant-type authorization-code
–redirect-uris “http://studio.www.credotraining.com:8001/complete/edx-oauth2/
–client-id cms-sso-dev
–client-secret 25jeicQuGEiMIBgGrnO5ZwI6
–scopes user_id
–skip-authorization
–update cms-sso-dev cms
Fix incorrect uploaded file path
if [ -d /openedx/data/uploads/ ]; then
if [ -n “$(ls -A /openedx/data/uploads/)” ]; then
echo “Migrating LMS uploaded files to shared directory”
mv /openedx/data/uploads/
/openedx/media/
rm -rf /openedx/data/uploads/
fi
fi
Create waffle switches to enable some features, if they have not been explicitly defined before
Completion tracking: add green ticks to every completed unit
(./manage.py lms waffle_switch --list | grep completion.enable_completion_tracking) || ./manage.py lms waffle_switch --create completion.enable_completion_tracking on