I am trying to connect to MySQL database, but strangly
mysql-connector-python is working in python shell, and not using VS Code.
I tried installing the following packages:
pip install mysql-connector
pip install mysql-connector-python
pip install mysql-connector-python-rf
No luck either. So, I uninstalled all packages then reinstalled only mysql-connector-python, then rebooted, to make sure there was no issue in this regard.
The error is:
ModuleNotFoundError: No module named 'mysql.connector'; 'mysql' is not a package
Python version: 3.9.4 VS Code: 1.6.20
Here are some screenshots:


mysql-connectorandmysql-connector-python-rf. The official (and maintained) MySQL connector ismysql-connector-python. Also check that you're not using a different Python version in VS Code. In the screenshots I see you're using a custom Python installation and VS Code is using the anaconda3.