Python Forum

Full Version: python with mysql utf8 error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a problem on my raspberry with mysql (mariadb). When I execute this simple programm it shows this error. The database is made in phpmyadmin (generated password : HV8AoxbZ2H44uNgX).

import mysql.connector

try:
db = mysql.connector.connect(host = "localhost", database = "dobot", user = "dobot", password = "HV8AoxbZ2H44uNgX")


if db.is_connected():
print("Connected to MySQL database.")
#return db
except mysql.connector.Error as e:
print ("Error while connecting to MySQL", e)
Error:
pi@raspberrypi:~/FTP/files/demo-magician-python-64-master $ python database.py Error while connecting to MySQL Character set 'utf8' unsupported
Whats is wrong with my settings?
utf8 is standard since python 3 release.
Please always show entire unmodified error traceback as it shows important program flow information.