UPDATE:

I didn’t know about the ARCHFLAGS environment variable, which is a less intrusive way (thanks to Sebastian for pointing this out):

sudo su -
ARCHFLAGS='-arch i386' gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

(sudo su - asks you for your normal password, not the root password)

I'm using the stock Ruby environment on Leopard and the MySQL package from http://www.mysql.com. Unfortunately, installing the MySQL driver as a gem doesn't work out of the box, and the default MySQL driver that comes with Rails seems to be quite buggy. To get it working we have to remove all occurrences of "-arch ppc" in rbconfig.rb; otherwise, it tries to compile the MySQL driver for the PowerPC Platform as well, which we don't want (assuming you have an Intel Mac - otherwise remove "-arch i386"). We also have to tell the driver where to find the the MySQL libs, includes and so on. We can do this by specifying the path for the mysql_config command.
cd /usr/lib/ruby/1.8/universal-darwin9.0/
sudo mv rbconfig.rb rbconfig.rb.orig
sudo sed "s/-arch ppc//g" rbconfig.rb.orig > rbconfig.rb
sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
(If you use a PPC Mac, replace ppc with i386 on line 2.)