Sluggish MySQL because of ContentProtect

A program I wrote using python and MySQL ran much, much slower on my development computer than on the client’s computer. And their computer seemed about the same spec as mine. I upgraded from python 2.4 to 2.5. Nope. Was it the RAM. Nope – they had half a Gb to my 1Gb. Was it the hard drive? The L1 and L2 cache? Who could tell.

A friend (a very good friend) suggested it might be a MySQL setting. I was looking around in there when I noticed the named pipe alternative to the TCP/IP protocol. TCP/IP. Hmmmm I had sort of noticed the wireless network icon flickering in the taskbar when running MySQL. Could it be ….. ContentProtect!?

I reconfigured MySQL to not use TCP/IP:

connMySQL = MySQLdb.connect(host=maint.DB_HOST, user=maint.DB_USER,
passwd=maint.DB_PWD, db=maint.DB_DATABASE,
named_pipe=maint.NAMED_PIPE)

http://mysql-python.sourceforge.net/MySQLdb.html

… and the program suddenly flew! I could barely keep up with the screen output. Unfortunately my favourite MySQL manager, SQLyog, did not support named pipes.

http://www.webyog.com/forums//index.php?s=035d8d492234b760704ed30c35331bdd
&showtopic=2314&view=findpost&p=10917

But if I switched on support for TCP/IP the code relying on named pipes stopped working. I would get “error 2017: can’t open named pipe to host”.

The answer was to manually add one line to my my.ini file – namely:
enable-named-pipe

Now I could use the named pipes where possible, thus sidestepping the numbing effect of ContentProtect, while still being able to use tools that required or expected TCP/IP.

A useful reference is on:
http://dev.mysql.com/doc/refman/5.0/en/can-not-connect-to-server.html
#can-not-connect-to-server-on-windows