asked    Donna     2018-09-16       python       235 view        1 Answer

[SOLVED] Connecting to MySQL with Django caching_sha2_password cannot be loaded

I had this error when I originally used my localhost for the Django application I am working on. I am now getting it when I am trying to connect to a new server. I cannot remember what I did to fix it.

 Performing system checks...

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x031F1E88>
Traceback (most recent call last):
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\base\base.py", line 216, in ensure_connection
    self.connect()
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\base\base.py", line 194, in connect
    self.connection = self.get_new_connection(conn_params)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\mysql\base.py", line 236, in get_new_connection
    return Database.connect(**conn_params)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\MySQLdb\__init__.py", line 86, in Connect
    return Connection(*args, **kwargs)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\MySQLdb\connections.py", line 204, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2059, "Authentication plugin 'caching_sha2_password' cannot be loaded: The specified module could not be found.\r\n")

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

Traceback (most recent call last):
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 120, in inner_run
    self.check(display_num_errors=True)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 364, in check
    include_deployment_checks=include_deployment_checks,
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 351, in _run_checks
    return checks.run_checks(**kwargs)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\registry.py", line 73, in run_checks
    new_errors = check(app_configs=app_configs)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\model_checks.py", line 27, in check_all_models
    errors.extend(model.check(**kwargs))
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\base.py", line 1200, in check
    errors.extend(cls._check_fields(**kwargs))
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\base.py", line 1272, in _check_fields
    errors.extend(field.check(**kwargs))
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\fields\__init__.py", line 894, in check
    errors = super().check(**kwargs)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\fields\__init__.py", line 206, in check
    errors.extend(self._check_backend_specific_checks(**kwargs))
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\fields\__init__.py", line 303, in _check_backend_specific_
checks
    return connections[db].validation.check_field(self, **kwargs)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\base\validation.py", line 21, in check_field
    field_type = field.db_type(self.connection)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\fields\__init__.py", line 648, in db_type
    return connection.data_types[self.get_internal_type()] % data
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 36, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\mysql\base.py", line 133, in data_types
    if self.features.supports_microsecond_precision:
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 36, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\mysql\features.py", line 65, in supports_microsecond_pre
cision
    return self.connection.mysql_version >= (5, 6, 4)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line 36, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\mysql\base.py", line 345, in mysql_version
    with self.temporary_connection() as cursor:
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\contextlib.py", line 81, in __enter__
    return next(self.gen)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\base\base.py", line 576, in temporary_connection
    cursor = self.cursor()
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\base\base.py", line 255, in cursor
    return self._cursor()
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\base\base.py", line 232, in _cursor
    self.ensure_connection()
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\base\base.py", line 216, in ensure_connection
    self.connect()
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\base\base.py", line 216, in ensure_connection
    self.connect()
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\base\base.py", line 194, in connect
    self.connection = self.get_new_connection(conn_params)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\mysql\base.py", line 236, in get_new_connection
    return Database.connect(**conn_params)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\MySQLdb\__init__.py", line 86, in Connect
    return Connection(*args, **kwargs)
  File "C:\Users\LL67773\AppData\Local\Programs\Python\Python36-32\lib\site-packages\MySQLdb\connections.py", line 204, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
django.db.utils.OperationalError: (2059, "Authentication plugin 'caching_sha2_password' cannot be loaded: The specified module could not be found.\r\n")

I am connected to the database through my MySQL workbench not sure if that helps narrow down the issue or not.

For clarification I have tried using most of the answers on this Question:

Authentication plugin 'caching_sha2_password' cannot be loaded

  1 Answer  

        answered    Adair     2018-09-16      

Hi got to this link and install connector/python. Then go to django setting.py file and locate the DATABASE section and edit it as follows:

 DATABASES = {
'default': {
    'ENGINE': 'mysql.connector.django',
    'NAME': 'name_of_the_database',
    'USER': 'you_user_name',
    'PASSWORD': 'your_password',
    'OPTIONS': {
      'autocommit': True,
    },
}

}

NB. the 'ENGINE': 'mysql.connector.django'





Your Answer





 2018-09-16         Daisy

Issue getting mysqli_query to execute

I have written the following function in PHP that has a mysqli_query in it that runs without any errors or exceptions. However, the INSERT INTO statement or $insert variable doesn't seem to be working as expected and I can't figure it out. I realize that posting only a portion of the code might make it difficult to ascertain why it is not working, but I am really looking for confirmation that there are no errors in this function. Do I need to utilize mysqli_real_escape_string for every url provided? I tried altering $website to $_website to account for this, but it returned...
 php                     1 answers                     27 view
 2018-09-16         Elvira

Your PHP installation appears to be missing the MySQL extension which is required by WordPress & r establishing a database connection

Error: Your PHP installation appears to be missing the MySQL extension which is required by WordPress. Hosting: Godaddy PHP version : 7.1I have tried to changed the PHP Version from cpanel when i select 7.1 php version it gives error "Error: Your PHP installation appears to be missing the MySQL extension which is required by WordPress." and when i select native version i.e 5.4 then it gives "Error establishing a database connection". I have set proper database connection then also it gives "Error establishing a database connection" error .I am not getting exactly wh...
 mysql                     1 answers                     28 view
 2018-09-16         Gale

Php double database entry in mysql database

My site accepts donations for charities. People donate and then their donations along with support messages are shown on the donation page.I have two problems.Problem is that sometimes but not all the time the donations are entered twice to the database which means they show twice on the front end as well.Screenshot of double database entry with same transaction idScreenshot of double entry on the front endBelow is the code that adds the donations and "cheers" messages to the database. I can't figure out why the entries occur twice sometimes but not always. When I look at t...
 php                     1 answers                     28 view