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:
The main issue was related to code runner. uninstall, then install did the trick.
I often face some error because of code runner not connecting to the right environment or not reading new package. Normally, restarting the visual studio code session or the whole software solve it, but not in this case.