NickName:user670186 Ask DateTime:2012-02-05T10:06:01 install python MySQLdb to python3 not python i have Ubuntu and installed python3 since my script is written in it. Since I use MYSQL with MySQLdb, I installed apt-get install python-mysqldb however this installed MySQLdb to Python (which is 2.6 on Ubuntu) and not to Python3. How can I install MySQLdb for Python3 Should I use it at all or switch to PyMSQL Sorry, I have just started working with Python today... Copyright Notice:Content Author:「user670186」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.Link to original article:https://stackoverflow.com/questions/9146320/install-python-mysqldb-to-python3-not-python Answers kgf3JfUtW 2018-10-26T06:42:24 How to install MySQLdb for Python2\n\nsudo apt-get install python-mysqldb\n\n\nHow to install MySQLdb for Python3\n\nsudo apt-get install python3-mysqldb\n", Ludo Schmidt 2018-07-25T09:29:06 This was a success for me on linux (UBUNTU) and anaconda:\n\nsudo apt-get install libmysqlclient-dev\n( it get mysql_config )\n\nthen \n\npip3 install git+git://github.com/davispuh/MySQL-for-Python-3\n\nthat's it...\n\nMore info on https://github.com/davispuh/MySQL-for-Python-3/wiki/Install-on-Linux", Aly Radwan 2017-11-10T09:47:03 1- You can use this command\nsudo apt-get install python3-mysqldb\nIt worked for me.\n2- also you can install pip install PyMySQL.\nThen add lines to __init__.py file\n# __init__.py file\n\nimport pymysql\npymysql.install_as_MySQLdb()\n", unutbu 2012-02-05T03:06:18 MySQLdb is not yet Python3 compatible, but\noursql, a Python-MySQL driver, is.", shadyabhi 2012-02-05T02:16:44 As far as I know, it's not ported to python3 yet. ", Thamayron Alves 2015-11-02T00:10:36 you can use this:\n\nhttps://github.com/davispuh/MySQL-for-Python-3/wiki/Install-on-Linux\n\nIt worked for me.",