1

$ python database.py Traceback (most recent call last): File "C:\Users\USER\Documents\TodayDatabase\database.py", line 3, in mydb = mysql.connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'mysql.connector' has no attribute 'connect'

connecting python to mysql but got an error

2 Answers 2

0

Check https://stackoverflow.com/a/61252423/18516611

TL;DR remove mysql-connector-python and run pip install mysql-connector-python

Sign up to request clarification or add additional context in comments.

Comments

0

Are sure you have used the following pip command: pip install mysql-connector-python, or just pip install mysql-connector?

Because if you did the second one you may need to uninstall mysql-connector and install mysql-connector-python

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.