James Eaves
James Eaves

Reputation: 1647

How can I use Conda to install MySQLdb?

I've read several different explanation regarding how to install MySQLdb, but I'm not sure which case applies to me since my error message is different. My system can't seem to find MySQLdb. I installed pymysql, but i need to import MySQLdb to use procedures from that library.

Thanks for your help.


$ conda install MySQLdb

Fetching package metadata: .... Error: No packages found in current osx-64 channels matching: mysqldb

Did you mean one of these?

pymysql

You can search for this package on anaconda.org with

anaconda search -t conda mysqldb

$ anaconda search -t conda mysqldb

Using anaconda-server api site https://api.anaconda.org Run 'anaconda show ' to get more details: No packages found Name | Version | Package Types | Platforms
------------------------- | ------ | --------------- | --------------- Found 0 packages

Upvotes: 16

Views: 62837

Answers (9)

Stefan
Stefan

Reputation: 42905

Since early 2018, the mysql package has become available from the conda and anaconda channels. The former is often more up-to-date and, as of April 2021, provides version 8 compared to the latter's version 5.

Install using

conda install -c conda-forge mysql

Upvotes: 6

Rishi
Rishi

Reputation: 17

Use this for mysqldb with python above 3.x

pip install mysqlclient

Upvotes: 0

武建涛
武建涛

Reputation: 11

Python 3.8 should execute the following command

conda install -c anaconda mysql-connector-python

Upvotes: 1

Adam Erickson
Adam Erickson

Reputation: 6363

For Anaconda Python, @StephenRauch has the correct solution, as it is officially supported in the Anaconda Enterprise documentation:

conda install -c anaconda mysql-connector-python

Reference: https://enterprise-docs.anaconda.com/en/latest/data-science-workflows/data/mysql.html

Upvotes: 0

WillMonge
WillMonge

Reputation: 1035

For those Googlers in 2018+, you can install from the bioconda channel

conda install -c bioconda mysqlclient

Upvotes: 16

kumar Gaurav
kumar Gaurav

Reputation: 21

try this:

conda install mysql-connector-python 

Upvotes: 2

Mao-Wei Nilsson
Mao-Wei Nilsson

Reputation: 11

~/anaconda2$ conda install mysql-python

works on ubuntu 16.04

Upvotes: 1

Bassem Shahin
Bassem Shahin

Reputation: 706

To install this package with conda run:

conda install -c anaconda mysql-python=1.2.5

check here: https://anaconda.org/anaconda/mysql-python

Upvotes: 3

maverik
maverik

Reputation: 301

Try to use this command:

conda install mysql-python

Upvotes: 30

Related Questions