Python Forum
MySql connection problem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MySql connection problem
#1
Hi,

I am trying to connect MySql using python, but it's showing error.


Error:
Traceback (most recent call last): File "/home/ai/Documents/Database/mysql.py", line 1, in <module> import mysql.connector File "/home/ai/Documents/Database/mysql.py", line 1, in <module> import mysql.connector ModuleNotFoundError: No module named 'mysql.connector'; 'mysql' is not a package
I try to install pip3 mysql.connector also but after installing it's now working and showing same error.
Reply
#2
I would guess that's because Python is trying to import mysql, which is your file name, so I think it's trying to import itself. If you change the name of your file, you should be fine. Be careful of overriding your imports with local file names :)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem in connect to MySQL workbench hm86z 0 1,671 Aug-26-2020, 12:05 PM
Last Post: hm86z

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020