I have downloaded and installed the Connector/Python for MySQL successfully with:
pip install mysql-connector-python
but when i run my Python File in terminal (Visual Studio Code) shows me this error:
ModuleNotFoundError: No module named 'mysql'
this is my code:
import mysql.connector
database = mysql.connector.connect(
host="localhost",
user="root",
passwd=""
#database="master_python"
)
I have tried to install mysql-connector-python-rf with:
pip install mysql-connector-python-rf
but shows me a big, red and awful error:
ERROR: Command errored out with exit status 1:
command: 'c:\program files\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Enrique Rubio\\AppData\\Local\\Temp\\pip-install-w1fo5muv\\mysql-connector-python-rf_a462ab4d49084651a288ddeacc8db2f3\\setup.py'"'"'; __file__='"'"'C:\\Users\\Enrique Rubio\\AppData\\Local\\Temp\\pip-install-w1fo5muv\\mysql-connector-python-rf_a462ab4d49084651a288ddeacc8db2f3\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Enrique Rubio\AppData\Local\Temp\pip-record-5uwbo9pj\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Enrique Rubio\AppData\Roaming\Python\Python38\Include\mysql-connector-python-rf'
cwd: C:\Users\Enrique Rubio\AppData\Local\Temp\pip-install-w1fo5muv\mysql-connector-python-rf_a462ab4d49084651a288ddeacc8db2f3\
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: option --single-version-externally-managed not recognized
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\program files\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Enrique Rubio\\AppData\\Local\\Temp\\pip-install-w1fo5muv\\mysql-connector-python-rf_a462ab4d49084651a288ddeacc8db2f3\\setup.py'"'"'; __file__='"'"'C:\\Users\\Enrique Rubio\\AppData\\Local\\Temp\\pip-install-w1fo5muv\\mysql-connector-python-rf_a462ab4d49084651a288ddeacc8db2f3\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Enrique Rubio\AppData\Local\Temp\pip-record-5uwbo9pj\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Enrique Rubio\AppData\Roaming\Python\Python38\Include\mysql-connector-python-rf' Check the logs for full command output.
I can't figure out why MySQL is not being recognized. PLEASE someone can help me.