Compiling mysql-python on OS X leopard

I’ve just finished trying to install mysql-python on OSX Leopard, and had quite a few problems. This is the procedure that finally ended up working for me. First, download mysql-python from here. Unzip and try to build it : ...

August 18, 2009 · 2 min · Dave Perrett

InnoDB as default MySQL table type

To change the default MySQL table type, edit your my.cnf file (usually /etc/mysql/my.cnf on ubuntu), and add the following line to the [mysqld] section : default-table-type=innodb The resulting config will look something like this : ...

August 9, 2009 · 1 min · Dave Perrett

Flushing the DNS cache on OS X

I often find that OS X refuses to obey my /etc/hosts file for some time after I change it. It seems that often you have to manually flush the DNS cache by hand to force host file changes to take effect. Under pre-leopard systems, use lookupd : > sudo lookupd -flushcache Starting with Leopard, lookupd has been replaced with dscacheutil : > sudo dscacheutil -flushcache

August 5, 2009 · 1 min · Dave Perrett

MySQL table 'is marked as crashed'

I recently had a problem trying to use mysqldump where it was complaining that mysqldump: Got error: 145: Table './recurser/wp_options' is marked as crashed and should be repaired when using LOCK TABLES This corrupted wp_options table actually caused wordpress to think it was a fresh install, and showed the interface to create the admin user to anyone who accessed recurser which is a little scary :) The solution was to go to the actual database directory, and run myisamchk -r on the offending table : ...

June 18, 2009 · 1 min · Dave Perrett

HTTPSHandler error using python 2.5 and GAE on OS X

If you are getting an error complaining that ‘module’ object has no attribute ‘HTTPSHandler’ running python 2.5 on OS X : ...

June 6, 2009 · 1 min · Dave Perrett

Python 2.5 "ImportError: No module named _md5" on OS X

If you are getting an error complaining about missing md5 running python 2.5 on OS X : Traceback (most recent call last): File "<string>", line 1, in <module> File "/Users/dave/Desktop/setuptools-0.6c9-py2.5.egg/setuptools/command/easy_install.py", line 21, in <module> File "/Users/dave/Desktop/setuptools-0.6c9-py2.5.egg/setuptools/package_index.py", line 2, in <module> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py", line 91, in <module> import hashlib File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/hashlib.py", line 133, in <module> md5 = __get_builtin_constructor('md5') File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/hashlib.py", line 60, in __get_builtin_constructor import _md5 ImportError: No module named _md5 … you need to install py25-hashlib :...

June 6, 2009 · 1 min · Dave Perrett

python 2.5 zipimport.ZipImportError on OS X

If you are getting an error similar to the following trying to run pythin2.5 on OS X : zipimport.ZipImportError: can't decompress data; zlib not available … you need to install py25-zlib : > sudo port install py25-zlib

June 6, 2009 · 1 min · Dave Perrett

Exclude tables from mysqldump

Recently I was in a position where i wanted to exclude 2 large tables from mysqldump, without specifying every single table I wanted to back up. After a bit of searching, it seems you can easily exclude tables from mysqldump using the –ignore-table option : > mysqldump -u dave -ppassword -h localhost --ignore-table=my_db_name.my_table_name my_db_name …obviously substituting your own username, password, db name and table name etc . As far as i can tell you can use this option multiple times to exclude multiple tables

June 2, 2009 · 1 min · Dave Perrett

'spec/rake/spectask' errors doing rake db:migrate

If you get an error similar to the following while running rake db:migrate : error no such file to load -- spec/rake/spectask … you need to install the rspec gem : > sudo gem install rspec

April 29, 2009 · 1 min · Dave Perrett

'Can't find Magick-config' error installing rmagick gem

If you are getting the error ‘Can’t find Magick-config’ when installing the RMagick gem, chances are you’re missing the libmagick9-dev library. /opt/ruby-enterprise-1.8.6-20090201/bin/ruby extconf.rb install rmagick checking for Ruby version >= 1.8.2... yes checking for gcc... yes checking for Magick-config... no Can't install RMagick 2.9.1. Can't find Magick-config in ..... To fix this on ubuntu, simply install libmagick : apt-get install libmagick9-dev

April 26, 2009 · 1 min · Dave Perrett