Install python mysqldb in python3 not python

I have Ubuntu and python3 is installed since it has a script written in it. Since I use MYSQL with MySQLdb, I installed

apt-get install python-mysqldb

however, this installed MySQLdb for Python (which is 2.6 on Ubuntu), not Python3.

  • How to install MySQLdb for Python3
  • Should I use it at all or switch to PyMSQL

Sorry, I just started working with Python today ...

+4
source share
4 answers

As far as I know, it is not ported to python3.

+2
source

MySQLdb is not yet compatible with Python3, but oursql is a Python-MySQL driver.

+3
source

You can use this command sudo apt-get install python3-mysqldb

It worked for me.

+1
source

Source: https://habr.com/ru/post/1394825/


All Articles