Character set 'utf8' unsupported in python mysql connector

Issue

I’m trying to connect my database to a python project using the MySQL connector.

However, when using the code below,

import mysql.connector

mydb =  mysql.connector.MySQLConnection(
  host="localhost",
  user="veensew",
  password="%T5687j5IiYe"
)

print(mydb)

I encounter the following error´╝Ü

mysql.connector.errors.ProgrammingError: Character set ‘utf8’ unsupported

I tried to find out why this is happening and I’m getting the same error always.

MySQL Connector version – 8.0.30

I’d appreciate any help. Thank you in advanced!

Solution

I ran into the same issue. There were apparently some changes in version 8.0.30 to the way utf8_ collations are handled (see MySQL Connector release notes). I installed version 8.0.29 which fixed the issue for me.

pip3 install mysql-connector-python==8.0.29

Answered By – Niklas

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published