On Tue, Mar 11, 2014 at 10:05 AM, Jaimin Pandya <lists / ruby-forum.com> wrote:
> I am trying to connect and using MySQL server from Ruby.
>
> When I run program like "ruby mysql.rb" then error display like:
>
> /home/jaimin/mysql.rb:6:in `<top (required)>': uninitialized constant
> Mysql (NameError)
>   from
> /home/jaimin/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:in
> `require'
>   from
> /home/jaimin/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:53:in
> `require'
>   from mysql.rb:2:in `<main>'
>
>
> How can I solve this error?

First of all, make sure you are requiring the gem, which is probably

require 'mysql'

Also, not sure if this is your case, but if you name your file exactly
the same as a gem that you require, you can have problems. Try
renaming your ruby file to something different to mysql.rb

Jesus.