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
            Asked
            
        
        
            Active
            
        
            Viewed 3.6k times
        
    4
            
            
        - 
                    Related: https://stackoverflow.com/q/4960048/1531971 – Jan 12 '18 at 19:16
3 Answers
9
            
            
        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
 
    
    
        michaelemery
        
- 101
- 1
- 6
1
            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
 
    
    
        M2skills
        
- 301
- 1
- 5
- 19
1
            
            
        Just use $sudo apt-get install python3-mysqldb and it works on pi-3.
 
    
    
        Bhanu Shree R
        
- 11
- 2
- 
                    1How is this different from any of the other answers? What makes your command line the best? – Jan 09 '18 at 16:42
- 
                    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. – Bhanu Shree R Jan 12 '18 at 19:07
- 
                    How does this differ substantially from the other answers? It's essentially a duplicate. – Jan 12 '18 at 19:17