During installing mysql2 gem on ruby :


checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile

Its basically saying you miss a library, good thing someone tracked it down (see askubuntu)

So for Centos 7 : (for Centos 6 most likely mysql-devel)

yum install mariadb-devel

for Debian/Ubuntu :

apt-get install libmysqlclient-dev

Damn you Ruby.