Python Forum

Full Version: Python 3.8 -- mysql-connector error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In my earlier post, it was reported that pip install of some packages fails in case of python 3.8, while there is no such problem for python 3.7.4

It is further observed that in case of mysql-connector, though pip install is successful in both versions, python 3.8 throws error on running relevant code, while the execution is smooth on python 3.7.4

Sample code:
import mysql.connector

mydb = mysql.connector.connect(
    host="localhost",
    user="adt",
    passwd="adt-MSQR"
)

print(mydb)
Output (Python-3.7.4):
Output:
<mysql.connector.connection_cext.CMySQLConnection object at 0x00000299018E8548>
On the other hand, if same code is run on python 3.8, following error is encountered:
Error:
Traceback (most recent call last): File "J:\AdtPython-Practice\MySQL\msqTest.py", line 12, in <module> mydb = mysql.connector.connect( File "C:\Program Files\Python38\lib\site-packages\mysql\connector\__init__.py", line 179, in connect return MySQLConnection(*args, **kwargs) File "C:\Program Files\Python38\lib\site-packages\mysql\connector\connection.py", line 95, in __init__ self.connect(**kwargs) File "C:\Program Files\Python38\lib\site-packages\mysql\connector\abstracts.py", line 716, in connect self._open_connection() File "C:\Program Files\Python38\lib\site-packages\mysql\connector\connection.py", line 208, in _open_connection self._do_auth(self._user, self._password, File "C:\Program Files\Python38\lib\site-packages\mysql\connector\connection.py", line 137, in _do_auth packet = self._protocol.make_auth( File "C:\Program Files\Python38\lib\site-packages\mysql\connector\protocol.py", line 99, in make_auth packet += self._auth_response(client_flags, username, password, File "C:\Program Files\Python38\lib\site-packages\mysql\connector\protocol.py", line 58, in _auth_response auth = get_auth_plugin(auth_plugin)( File "C:\Program Files\Python38\lib\site-packages\mysql\connector\authentication.py", line 190, in get_auth_plugin raise errors.NotSupportedError( mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported
Any Clue?
(Oct-26-2019, 02:57 PM)buran Wrote: [ -> ]check this -

Thanks buran. The problem stands resolved.

It is found that whereas mysql-connector was adequate for python 3.7.4, it is necessary to install mysql-connector-python for python 3.8 (otherwise, it leads to error).
I believe mysql-connector-python was the correct/offical one for long time now
watched the following video: https://www.youtube.com/watch?v=tGinfzlp0fE

followings the below steps :

MySQL-connector causes a problem.
pip uninstall MySQL-connector

The following may not need but removed both connectors completely.
pip uninstall MySQL-connector-python

re-install MySQL-connect-python connector.
pip install MySQL-connector-python