Hi guys,

I'd like to use Python to connect to my MariaDB db, it works from phpmyadmin and if I open a console with mysql -u root -p.

I tried:

$ pip search mysql-connector | grep --color mysql-connector-python

mysql-connector-python (8.0.19) - MySQL driver written in Python mysql-connector-python-rf (2.2.2) - MySQL driver written in Python mysql-connector-python-dd (2.0.2) - MySQL driver written in Python

$ pip install mysql-connector-python-rf

Requirement already satisfied: mysql-connector-python-rf in /usr/local/lib/python2.7/dist-packages (2.2.2)

When I try my code (obviously I replaced parameters with mine!):

import mysql.connector

mydb = mysql.connector.connect(
  host="localhost",
  user="root",
  passwd="mypwd"
)

print(mydb)

I have:

Traceback (most recent call last):
File "/home/gabriele/Corso_4.0/Python/Test_MySQL2.py", line 1, in <module>
    import mysql.connector
ModuleNotFoundError: No module named 'mysql'
>>>

What could I do to fix this issue?! :\

Thanks!
^Bart
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to