Home >Database >Mysql Tutorial >Why Does My Python MySQL Connection Fail with 'caching_sha2_password' Not Supported?

Why Does My Python MySQL Connection Fail with 'caching_sha2_password' Not Supported?

DDD
DDDOriginal
2024-12-12 22:31:16302browse

Why Does My Python MySQL Connection Fail with

MySQL Authentication Plugin Issue: 'caching_sha2_password' Not Supported

When attempting to connect to a MySQL server using the Python connector and creating a user with the mysql_native_password authentication plugin, an error message appears:

mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported

To resolve this issue, ensure that the correct Python package is installed. In the example code provided:

import mysql.connector

cnx = mysql.connector.connect(user='lcherukuri', password='password',
                              host='127.0.0.1',
                              database='test')
cnx.close()

Check that mysql-connector-python is installed instead of mysql-connector.

The above is the detailed content of Why Does My Python MySQL Connection Fail with 'caching_sha2_password' Not Supported?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn