Skip to content
Advertisement

Can’t import mysql.connector in Python

As the title says, i can’t import mysql.connector in python on Debian 9.13

This is what i did

JavaScript

I tried installing, uninstalling and reinstalling mysql-connector, mysql-connector-python and mysql-connector-python-rf in Python2.7 and Python3

Before someone flags this question as duplicated, i already tried all the answers in this posts:

This connection is using {tls_version} which is now

Unresolved import mysql.connector PYTHON

import mysql.connector ModuleNotFoundError: No module named ‘mysql.connector’; ‘mysql’ is not a package

mysql connector not found

ImportError: No module named ‘MySQL’

This connection is using {tls_version} which is now, unable to deploy Flask application on Linux

Any help would be appreciated.

Advertisement

Answer

As @TimRoberts and @Dhivakar Chelladurai said in te comments, the solution is to find a version of MySQL-Connector-Python for Python2 or Python3.5 max as this is the last version that Debian 9 has for Python3.

  1. Download:
JavaScript
  1. Install:
JavaScript

Thats it!

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement