On Wed, Mar 5, 2014 at 4:05 PM, Jaimin Pandya <lists / ruby-forum.com> wrote:
> I am new for MySQL and Ruby.
>
> require 'rubygems'

With current Ruby versions the line above should not be necessary.

> require 'mysql'
> # Connect to a MySQL database 'test' on the local machine
> # using username of 'root' with no password.
> db = Mysql.connect('localhost', 'root', '', 'test')

> When I try to run above program, I got error like following:
>
> mysql.rb:6:in `connect': Access denied for user 'root'@'localhost'
> (using
>
> password: NO) (Mysql::Error)
>
> from mysql.rb:6:in `<main>'
>
>  How can I able to solve this error?

Can you access the database with these credentials with the MySQL
command line tool?  If not you need to use proper credentials that you
have set up your database with.  If you can something with your Ruby
setup seems to be broken.

Cheers

robert


-- 
[guy, jim].each {|him| remember.him do |as, often| as.you_can - without end}
http://blog.rubybestpractices.com/