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
Release: 2024-12-12 22:31:16
Original
297 people have browsed it

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
Copy after login

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()
Copy after login

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!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template