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 :
...
I have a users table and an assets (basically just images) table, and I want to select and display a random asset for each user. I want to show a list of users, with a random thumbnail for each user from their assets.
I could do this easily enough in code with multiple queries, but it seemed like a nice challenge to try and find a pure-sql alternative.
...
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 :
...
Often MySQL will need to be forced to return results in UTF8 encoding. There are two ways to do this:
...
If you want to (for example) delete all users with the guest role from your database :
DELETE FROM user WHERE EXISTS ( SELECT * FROM role WHERE role.id = user.role_id AND role.name = 'guest' );