Yes, there are a billion posts about this very topic. I’ve installed this gem many times, and it’s always annoying. Rather than go through the hassle of installing the gem, watching the compile fail, fixing the ulong define in the gem source code, regenerating the Makefile, and then making the gem again, there’s an easier way.
In “/usr/local/mysql/include/typelib.h” (or wherever you have MySQL installed), add the following.
#define ulong unsigned long
gem command should work fine.
$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config