ImportError: No module named 'MySQL'

后端 未结 17 1712
轮回少年
轮回少年 2020-12-12 17:40

I have downloaded the Connector/Python for MySQL successfully. I used the following code in Python\'s shell to test my connection:

import mysql.connector

17条回答
  •  自闭症患者
    2020-12-12 18:15

    This problem was a plague to me!!! The 100% solution is to forget using the mysql module: import mysql.connector, instead use pymysql via import pymysql. I installed it via the instructions: python3 -m pip install PyMySQL

    made a change to the: 1. Import statement 2. The connector 3. The cursor

    After that everything worked like a charm. Hope this helps!

提交回复
热议问题