1

I am hosting a PHP/MySQL web app on an Azure Windows server. One of the lines in the PHP executes a python script but the script uses the MySQLdb module which I believe is part of the _mysql module.

I have tried using the pip commands in just about every directory that I could think of. I've also upgraded pip as well

sudo apt-get install python-pip python-dev libmysqlclient-dev

pip install _mysql pip install MySQLdb

D:/home/python364x64/pip.bat install _mysql

Error messages range from "'sudo' is not recognized as an internal or external command, operable program or batch file. to: ERROR: Could not find a version that satisfies the requirement MySQLdb (from versions: none) ERROR: No matching distribution found for MySQLdb

1 Answers1

0

On windows server, you cannot use sudo, please use 'python -m pip' instead. For python 3.x, you should install mysqlclient, If you need 1.2.x versions (legacy Python only), use pip install MySQL-python. See How to install Python MySQLdb module using pip?.

Md Farid Uddin Kiron
  • 16,817
  • 3
  • 17
  • 43
  • Thanks for the tip. I'm trying this and I am only getting "ERROR: unknown command "MySQL-python"" back. I have tried changing it to 'python -m pip _mysql' or 'python -m pip MySQLdb' and im getting the same error – Jack Gibson Jul 30 '19 at 15:15
  • You should use "python -m pip install ". Please have a try with "python -m pip install MySQLdb" or "python -m pip install mysqlclient". – Md Farid Uddin Kiron Jul 31 '19 at 01:57