After Gentoo's emerge -u world upgraded MySQL to version 5.0.24, Ruby on Rails stopped working completely. This error was in my logs:

Mysql::Error: Commands out of sync; you can't run this command now

Update: Steps 1 and 2 are optional. Just following steps 3 and 4 may fix the problem completely in some cases, though running revdep-rebuild is recommended.

To fix:

1. emerge gentoolkit (if you have not already)

2. revdep-rebuild This command which is part of the gentoolkit is the Gentoo Reverse Dependency rebuilder. It will scan your installed ebuilds to find packages that have become broken as a result of an upgrade of a package they depend on. For more information see the gentoolkit page documenation.

3. emerge mysql-ruby

4. Stop MySQL, your webserver, and the start them up again.
In my case (lighttpd) I ran:

/etc/init.d/mysql stop
/etc/init.d/lighttpd stop
/etc/init.d/lighttpd start

(MySQL is a dependency in the lighttpd init script, so it will be started too)

This should get everything back up and running.