MySQLdb adapter

17 views
Skip to first unread message

Narshe

unread,
Oct 12, 2008, 8:08:23 PM10/12/08
to Django users
I'm running Windows XP with WAMPSERVER 2.0 installed. Python2.6
MySQL is installed on my computer at this location: C:\wamp\bin\mysql
Here is how my settings.py is set up:
DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'pythonDB'
DATABASE_USER = 'py'
DATABASE_PASSWORD = '#py'
DATABASE_HOST = ''
DATABASE_PORT = '3306'
I downloaded the adapter needed (MySQLdb, http://www.djangoproject.com/r/python-mysql/).
I used 7zip to place in C:\Python26\Lib\site-packages\MySQL-
python-1.2.2. When I cd to that and input 'setup.py install' , here
is
the output:
C:\Python26\Lib\site-packages\MySQL-python-1.2.2>setup.py install
running install
running bdist_egg
running egg_info
writing MySQL_python.egg-info\PKG-INFO
writing top-level names to MySQL_python.egg-info\top_level.txt
writing dependency_links to MySQL_python.egg-info
\dependency_links.txt
deleting MySQL_python.egg-info\native_libs.txt
reading manifest file 'MySQL_python.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'MySQL_python.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build
creating build\lib.win32-2.6
copying _mysql_exceptions.py -> build\lib.win32-2.6
creating build\lib.win32-2.6\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-2.6\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-2.6\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-2.6\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-2.6\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-2.6\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-2.6\MySQLdb
creating build\lib.win32-2.6\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-2.6\MySQLdb
\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-2.6\MySQLdb
\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build
\lib.win32-2.6\MySQLdb
\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-2.6\MySQLdb
\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-2.6\MySQLdb
\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win32-2.6\MySQLdb
\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-2.6\MySQLdb
\constants
running build_ext
building '_mysql' extension
error: None
Ok notice the "building '_mysql' extension" part.
Now when I go to the Python Shell:
>>> import MySQLdb

Traceback (most recent call last):
File "<stdin>", Line 1, in <module>
ImportError: No module named MySQLdb
If I put the MySQLdb folder in the site-packages dir:
>>> import MySQLdb

Traceback (most recent call last):
File "<stdin>", Line 1, in <module>
File "C:\Python26\Lib\site-packages\MySQLdb\__init__.py", line 19
in <module>
import _mysql
ImportError: No module named _mysql
So my question is how do I correctly install the MySQLdb adapter? Or
more specifically, can my current setup be saved? (Go easy on me, I
just started with Django 2 days ago) Thanks bunches in advance ^^
--Narshe

Karen Tracey

unread,
Oct 12, 2008, 8:39:18 PM10/12/08
to django...@googlegroups.com
On Sun, Oct 12, 2008 at 8:08 PM, Narshe <fodo...@gmail.com> wrote:

I'm running Windows XP with WAMPSERVER 2.0 installed. Python2.6
MySQL is installed on my computer at this location: C:\wamp\bin\mysql
Here is how my settings.py is set up:
[snip]

running build_ext
building '_mysql' extension
error: None
Ok notice the "building '_mysql' extension" part.

Where it says "error: None" I think what it is really saying is "error: I don't know what's wrong".  That is, it didn't build but has no information about what, specifically, went wrong.

I once spent a bit of time trying to build MySQLdb on Windows and failed.  I don't know what C compiler it builds properly with, but it's apparently not any of the free-software ones I tried, where header file conflicts between what the compiler and MySQL provided generated a mess of duplicate conflicting #defines that I didn't care to get to the bottom of. 

So, I have stuck with the precompiled Windows binaries available for MySQLdb, that is the .exe files available here:

http://sourceforge.net/project/showfiles.php?group_id=22307&package_id=15775

Unfortunately that means Python 2.5, not Python 2.6, since there is no .exe available for Python 2.6.

Karen

Narshe

unread,
Oct 12, 2008, 9:23:14 PM10/12/08
to Django users
I was hoping I wouldn't have to use 2.5 instead of 2.6 but thats what
it looks like I must do. Thanks for the look into my problem.

On Oct 12, 5:39 pm, "Karen Tracey" <kmtra...@gmail.com> wrote:
> On Sun, Oct 12, 2008 at 8:08 PM, Narshe <fodoo...@gmail.com> wrote:
>
> > I'm running Windows XP with WAMPSERVER 2.0 installed. Python2.6
> > MySQL is installed on my computer at this location: C:\wamp\bin\mysql
> > Here is how my settings.py is set up:
> > [snip]
> > running build_ext
> > building '_mysql' extension
> > error: None
> > Ok notice the "building '_mysql' extension" part.
>
> Where it says "error: None" I think what it is really saying is "error: I
> don't know what's wrong".  That is, it didn't build but has no information
> about what, specifically, went wrong.
>
> I once spent a bit of time trying to build MySQLdb on Windows and failed.  I
> don't know what C compiler it builds properly with, but it's apparently not
> any of the free-software ones I tried, where header file conflicts between
> what the compiler and MySQL provided generated a mess of duplicate
> conflicting #defines that I didn't care to get to the bottom of.
>
> So, I have stuck with the precompiled Windows binaries available for
> MySQLdb, that is the .exe files available here:
>
> http://sourceforge.net/project/showfiles.php?group_id=22307&package_i...
Reply all
Reply to author
Forward
0 new messages