<p>I can get Python to work with Postgresql but I cannot get it to work with MySQL. The main problem is that on the shared hosting account I have I do not have the ability to install things such as Django or PySQL, I generally fail when installing them on my computer so maybe it's good I can't install on the host.</p>

<p>I found <a href="http://barryp.org/software/bpgsql/" rel="noreferrer">bpgsql</a> really good because it does not require an install, it's a single file that I can look at, read and then call the functions of. Does anybody know of something like this for MySQL?</p>

[{'answer_id': 777, 'author': 'ESV', 'author_id': 150, 'author_profile': 'https://Stackoverflow.com/users/150', 'pm_score': 3, 'selected': False, 'text': '<p>I don\'t have any experience with <a href="http://www.SiteGround.com" rel="noreferrer">http://www.SiteGround.com</a> as a web host personally.  </p>\n\n<p>This is just a guess, but it\'s common for a shared host to support Python and MySQL with the MySQLdb module (e.g., GoDaddy does this).  Try the following CGI script to see if MySQLdb is installed.</p>\n\n<pre><code>#!/usr/bin/python\n\nmodule_name = \'MySQLdb\'\nhead = \'\'\'Content-Type: text/html\n\n%s is \'\'\' % module_name\n\ntry:\n    __import__(module_name)\n    print head + \'installed\'\nexcept ImportError:\n    print head + \'not installed\'\n</code></pre>\n'}, {'answer_id': 802, 'author': 'Teifion', 'author_id': 1384652, 'author_profile': 'https://Stackoverflow.com/users/1384652', 'pm_score': 3, 'selected': False, 'text': '<p>I uploaded it and got an internal error</p>\n\n<pre><code>Premature end of script headers\n</code></pre>\n\n<p>After much playing around, I found that if I had</p>\n\n<pre><code>import cgi\nimport cgitb; cgitb.enable()\nimport MySQLdb\n</code></pre>\n\n<p>It would give me a much more useful answer and say that it was not installed, you can see it yourself -> <a href="http://woarl.com/db.py" rel="nofollow noreferrer">http://woarl.com/db.py</a></p>\n\n<p>Oddly enough, this would produce an error</p>\n\n<pre><code>import MySQLdb\nimport cgi\nimport cgitb; cgitb.enable()\n</code></pre>\n\n<p>I looked at some of the other files I had up there and it seems that library was one of the ones I had already tried.</p>\n'}, {'answer_id': 1619, 'author': 'Justin Standard', 'author_id': 92, 'author_profile': 'https://Stackoverflow.com/users/92', 'pm_score': 6, 'selected': True, 'text': '<p>MySQLdb is what I have used before.</p>\n\n<p>If you host is using Python version 2.5 or higher, support for sqlite3 databases is built in (sqlite allows you to have a relational database that is simply a file in your filesystem).  But buyer beware, sqlite is not suited for production, so it may depend what you are trying to do with it.</p>\n\n<p>Another option may be to call your host and complain, or change hosts.  Honestly these days, any self respecting web host that supports python and mysql ought to have MySQLdb pre installed.</p>\n'}, {'answer_id': 8332, 'author': 'Harley Holcombe', 'author_id': 1057, 'author_profile': 'https://Stackoverflow.com/users/1057', 'pm_score': 3, 'selected': False, 'text': '<p>You could try setting up your own python installation using <a href="http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python" rel="noreferrer">Virtual Python</a>.  Check out how to setup Django using it <a href="http://forums.site5.com/showthread.php?t=10236" rel="noreferrer">here</a>.  That was written a long time ago, but it shows how I got MySQLdb setup without having root access or anything like it.  Once you\'ve got the basics going, you can install any python library you want.</p>\n'}, {'answer_id': 4813530, 'author': 'd0nut', 'author_id': 499257, 'author_profile': 'https://Stackoverflow.com/users/499257', 'pm_score': 3, 'selected': False, 'text': "<p>You really want MySQLdb for any MySQL + Python code.  However, you shouldn't need root access or anything to use it.  You can build/install it in a user directory (~/lib/python2.x/site-packages), and just add that to your PYTHON_PATH env variable.  This should work for just about any python library.</p>\n\n<p>Give it a shot, there really isn't a good alternative.</p>\n"}, {'answer_id': 33058407, 'author': 'Serjik', 'author_id': 546822, 'author_profile': 'https://Stackoverflow.com/users/546822', 'pm_score': 2, 'selected': False, 'text': '<p>Take a pick at</p>\n\n<p><a href="https://docs.djangoproject.com/en/1.8/ref/databases/" rel="nofollow">https://docs.djangoproject.com/en/1.8/ref/databases/</a></p>\n\n<p>MySQLdb is mostly used driver, but if you are using python3 and django 1.8.x that will not work, then you should use mysqlclient that is a folk of MySQLdb on the following link</p>\n\n<p><a href="https://pypi.python.org/pypi/mysqlclient" rel="nofollow">https://pypi.python.org/pypi/mysqlclient</a></p>\n'}]
['https://Stackoverflow.com/questions/766', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1384652/']