I am facing difficulties in installing Ruby Gems on my Ubuntu 19.04 Whenever I try to install the gem, I get make failed, exit code 2. However, MySQL is correctly installed on my OS. And even Ruby server works, but without MySQL database.

greyshader@ScarlettHaven:~$ sudo gem install mysql
Building native extensions. This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.5.0/gems/mysql-2.9.1/ext/mysql_api
/usr/bin/ruby2.5 -r ./siteconf20190611-30763-iq3xfl.rb extconf.rb
checking for mysql_ssl_set()... yes
checking for rb_str_set_len()... yes
checking for rb_thread_start_timer()... no
checking for mysql.h... yes
creating Makefile

current directory: /var/lib/gems/2.5.0/gems/mysql-2.9.1/ext/mysql_api
make "DESTDIR=" clean

current directory: /var/lib/gems/2.5.0/gems/mysql-2.9.1/ext/mysql_api
make "DESTDIR="
compiling mysql.c
mysql.c: In function ‘stmt_bind_result’:
mysql.c:1320:74: error: ‘rb_cFixnum’ undeclared (first use in this function); did you mean ‘rb_isalnum’?
  else if (argv[i] == rb_cNumeric || argv[i] == rb_cInteger || argv[i] == rb_cFixnum)
mysql.c:1320:74: note: each undeclared identifier is reported only once for each function it appears in
make: *** [Makefile:243: mysql.o] Error 1

make failed, exit code 2

Gem files will remain installed in /var/lib/gems/2.5.0/gems/mysql-2.9.1 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/mysql-2.9.1/gem_make.out

My Ruby Version is:

greyshader@ScarlettHaven:~$ ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]

My rails version is:

greyshader@ScarlettHaven:~$ rails --version
Rails 6.0.0.rc1

But when I try to see the version on mySQL, I get an error:

greyshader@ScarlettHaven:~$ mysql -version
ERROR 1045 (28000): Access denied for user 'greyshader'@'localhost' `(using password: NO)`
  • I'm getting the same error when trying to install github pages on my system
    – Hotbelgo
    Aug 24, 2019 at 9:00

1 Answer 1


Seems to be that this gem is not supported anymore. Try using mysql2-gem instead

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.