Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

installing mysql connector for python 3 in raspberry pi

I am new at using raspberry pi. I have a python 3.4 program that connects to a database on hostinger server. I want to install mysql connector in raspberry pi.I searched a lot but I was not able to find answers . any help would be appreciated

like image 686
M2skills Avatar asked Dec 19 '22 15:12

M2skills


2 Answers

Before you install, it is important to run update and upgrade;

sudo apt-get update
sudo apt-get upgrade

Either install connector for Python 2;

sudo apt-get -y install python-mysql.connector

Or install connector for Python 3;

sudo apt-get -y install python3-mysql.connector
like image 190
michaelemery Avatar answered Dec 21 '22 06:12

michaelemery


I found no way to install mysql-connector-python that I used with windows. for python 3.4 I used the command

sudo python3 -m pip install pymysql

for python 2.7 you can use following commands

 sudo apt-get install python-mysqldb

or

sudo apt-get install python-pip
pip install pymysql
like image 32
M2skills Avatar answered Dec 21 '22 06:12

M2skills