Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install mysql-connector for python 3.5.1?

I'm on python 3.5.1 and I am having trouble installing mysql connector:

install --allow-external mysql-connector-python-rf mysql-connector-python-rf

is not working, neither is the normal pip command for mysql-connector-python-rf. I am getting the following message:

error: option --single-version-externally-managed not recognized

Any ideas?

like image 405
Shruf Avatar asked Feb 03 '16 05:02

Shruf


People also ask

How do I install MySQL connector Python?

Installation: To install Python-mysql-connector module, one must have Python and PIP, preinstalled on their system. To check if your system already contains Python, go through the following instructions: Open the Command line(search for cmd in the Run dialog( + R).

How do I install MySQL on Python 3?

The easiest way to probably install and use MySQL in Python is to open up your command prompt. Once the command prompt is opened, then specify the full path to the Scripts folder of the Python package. Once you have this full path specified to the Scripts folder, then type in, pip install pymysql.

Which version of Python is needed for the MySQL Python connector?

MySQL Connector/Python 8.0 is highly recommended for use with MySQL Server 8.0, 5.7, and 5.6.


1 Answers

There is no mysql-connector for python 3.5.1 up till now, but you can use pymysql to connect mysql to python 3.5.1!

import pymysql

conn = pymysql.connect(host='localhost', port=port_no, user='db_user', passwd='password', db='db_name')
like image 146
Haroon Ahmed Avatar answered Sep 24 '22 18:09

Haroon Ahmed