Connecting ruby with mysql

i am using ruby 1.9.3 and MySQL server 5.1

i am creating ruby files in ruby mine editor 7.1.4.

I am getting error in below code

require ‘rubygems’
require ‘mysql’

begin
db = Mysql.real_connect(“localhost”, “root”, “tiger”,“test”)
puts "Server version: " + db.get_server_info
rescue Mysql::Error => e
puts “Error code: #{e.errno}”
puts “Error message: #{e.error}”
puts “Error SQLSTATE: #{e.sqlstate}” if e.respond_to?(“sqlstate”)
ensure
db.close if db
end

while running the above code

it showing the below error

:in `require’: cannot load such file – mysql (LoadError)

I am not able to connect with MySQL.

That gem is:

https://rubygems.org/gems/mysql

It seems not so active anymore.

Try another one:

https://rubygems.org/gems/mysql2

Last update, September 2015.

Check the docu too.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs