Set LD_LIBRARY_PATH to be /opt/lib so libssl.so.0.9.8 and libcrypto.so.0.9.8 can be found. Alternatively symlink them to /usr/lib might work as well.
Install ruby & rubygems from source, using default options.
Then run this to install mysql gem.
gem install mysql -- --with-mysql-dir=/usr/local/mysql