OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

in python mysql.connector why i see the this Errors?

  • Thread starter Thread starter Mohamed Abd El Ghafar
  • Start date Start date
M

Mohamed Abd El Ghafar

Guest
I am a new user for python

import mysql.connector

try:

conn = mysql.connector.connect(

host='localhost',

user='root',

passwd=''

)

mycur=conn.cursor()

mycur.execute('creat database rakwan')

except mysql.connector.Error as r:

print(r)

the Error is:-

PS C:\\Users\\computer 8\> & "C:/Users/computer 8/AppData/Local/Programs/Python/Python312/python.exe" e:/PROGRAMING/python/Racoon/Learn/mq.py

Traceback (most recent call last):

File "e:\\PROGRAMING\\python\\Racoon\\Learn\\mq.py", line 1, in \<module\>

import mysql.connector

File "e:\\PROGRAMING\\python\\Racoon\\Learn\\mysql.py", line 1, in \<module\>

import mysql.connector

ModuleNotFoundError: No module named 'mysql.connector'; 'mysql' is not a package

pip install mysql

pip install mysql-connector

pip install mysql-connector-python-rf
<p>I am a new user for python</p>
<p>import mysql.connector</p>
<p>try:</p>
<p>conn = mysql.connector.connect(</p>
<p>host='localhost',</p>
<p>user='root',</p>
<p>passwd=''</p>
<p>)</p>
<p>mycur=conn.cursor()</p>
<p>mycur.execute('creat database rakwan')</p>
<p>except mysql.connector.Error as r:</p>
<p>print(r)</p>
<p>the Error is:-</p>
<p>PS C:\\Users\\computer 8\> & "C:/Users/computer 8/AppData/Local/Programs/Python/Python312/python.exe" e:/PROGRAMING/python/Racoon/Learn/mq.py</p>
<p>Traceback (most recent call last):</p>
<p>File "e:\\PROGRAMING\\python\\Racoon\\Learn\\mq.py", line 1, in \<module\></p>
<p>import mysql.connector</p>
<p>File "e:\\PROGRAMING\\python\\Racoon\\Learn\\mysql.py", line 1, in \<module\></p>
<p>import mysql.connector</p>
<p>ModuleNotFoundError: No module named 'mysql.connector'; 'mysql' is not a package</p>
<p>pip install mysql</p>
<p>pip install mysql-connector</p>
<p>pip install mysql-connector-python-rf</p>
 

Latest posts

Top