1
engine = create_engine('mysql+mysqldb://root:123456@localhost:3306/tianchi?charset=utf8mb4')

Traceback:

sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (2019, "Can't initialize character set utf8mb4 (path: C:\mysql\\share\charsets\)")

enter image description here

sqlalchemy:1.2.7 Mysql-python:1.2.5 Mysql:5.7.13

4
  • What is the location of "utf8mb4" file? Commented May 14, 2018 at 9:38
  • dev.mysql.com/doc/refman/5.7/en/… Commented May 14, 2018 at 9:46
  • @KKK I don't know "utf8mb4” file name, and 'set names utf8mb4' works in MySQL client. Commented May 15, 2018 at 0:55
  • @Daniel E. I copyed "..\share\charsets\" to "C:\mysql\\share\charsets\",but it didn't work Commented May 15, 2018 at 0:57

1 Answer 1

2

I replace 'mysqldb' with 'pymysql' and it works.Thank everyone.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, thank you, thank you! For me, the change was FROM: mysql+mysqlconnector TO mysql+pymysql

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.