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
3 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
1 Comment
Madhav Malhotra
Any suggestions to make this work for a Pi 4B? I ran all the commands listed above with
Python 3.11.2, pip 23.0.1 installed. It told me that package python3-mysql.connector has no installation candidate. My Pi has aarch64 architecture running Debian GNU Linux 12 (bookworm), Linux Kernel release 6.1.0-rpi6-rpi-v8, and Linux Kernel version #1 SMP PREEMPT Debian 1:6.1.58-1+rpt2 (2023-10-27).Just use $sudo apt-get install python3-mysqldb and it works on pi-3.
3 Comments
Bhanu Shree R
it's answering exactly what the person requested for, I thought it's a straight forward answer for someone who might be visiting this page again. Thanks.