The company work had bought domain name under NameCheap (no Root access)

All I now need is setup the database and webpage will be working

My company system use:

Apache Version: 2.4.38

MySQL Version: 10.1.38-MariaDB-cll-lve

Architecture: x86_64

Operating System: Linux

Python: 3.7

Django: 2.1.7

but when I run python manage.py migrate

I had this error:

Traceback (most recent call last):
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
    self.connect()
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/db/backends/base/base.py", line 194, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 227, in get_new_connection
    return Database.connect(**conn_params)
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/MySQLdb/__init__.py", line 84, in Connect
    return Connection(*args, **kwargs)
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/MySQLdb/connections.py", line 164, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
MySQLdb._exceptions.OperationalError: (2013, 'Lost connection to MySQL server at \'reading initial communication packet\', system error: 2 "No such file or directory"')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/core/management/base.py", line 350, in execute
    self.check()
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/core/management/base.py", line 379, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 59, in _run_checks
    issues = run_checks(tags=[Tags.database])
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/core/checks/registry.py", line 71, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/core/checks/database.py", line 10, in check_database_backends
    issues.extend(conn.validation.check(**kwargs))
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/db/backends/mysql/validation.py", line 9, in check
    issues.extend(self._check_sql_mode(**kwargs))
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/db/backends/mysql/validation.py", line 13, in _check_sql_mode
    with self.connection.cursor() as cursor:
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/db/backends/base/base.py", line 255, in cursor
    return self._cursor()
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/db/backends/base/base.py", line 232, in _cursor
    self.ensure_connection()
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
    self.connect()
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
    self.connect()
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/db/backends/base/base.py", line 194, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 227, in get_new_connection
    return Database.connect(**conn_params)
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/MySQLdb/__init__.py", line 84, in Connect
    return Connection(*args, **kwargs)
  File "/home/letsilap/virtualenv/IOT/3.7/lib/python3.7/site-packages/MySQLdb/connections.py", line 164, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server at \'reading initial communication packet\', system error: 2 "No such file or directory"')

I did some searching on StackOverflow:

Error during Django "Running migrations": django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server during query')

Trouble closing and reopening MySQL connection after catching/handling django.db.utils.OperationalError (2013, Lost connection to server)

but it was not very helpfully

further digging on the subject lead to me believe that MYSQL database is denying the access to my Django app.

I could try this theory as I don't access to MYSQL setting at all

To summarzie; I need migrate on django app but I had error running the command.

Help, please, I really appracite if you could help me with this.

2 Answers

1
Community On Best Solutions

I'm new to coding. Maybe you make a beginner mistake?

mismatch of the word? Include, cap underline?

I don't know if I was helping.

Just suggesting

1
I'm a IT Dumb Head On

This could cause by MYSQL DB having a time.

you correct this by going into the MySQL Workbench and set long DMSB.

Here the link on article responding to this error: https://anothercoffee.net/fix-error-code-2013-lost-connection-mysql-server-query/

The mysql official document on this issue; https://dev.mysql.com/doc/refman/5.7/en/error-lost-connection.html

Hope this help