# Problem while connecting to MYSQL from NetBeans

**URL:** <https://www.ruby-forum.com/t/problem-while-connecting-to-mysql-from-netbeans/166337>\
**Category:** Rails\
**Created:** [April 24, 2009, 3:33am UTC](https://www.ruby-forum.com/t/problem-while-connecting-to-mysql-from-netbeans/166337 "2009-04-24T03:33:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lakshmi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ea5d25/32.png) [@lakshmi](https://www.ruby-forum.com/u/lakshmi)\
**Post date:** [April 24, 2009, 3:33am UTC](https://www.ruby-forum.com/t/problem-while-connecting-to-mysql-from-netbeans/166337/1 "2009-04-24T03:33:11Z")

</div>

Hi All,

I am new to Ruby , ROR and NetBeans.

I am using Netbeans 6.5, Ruby 1.8 versions.

I created New Project in NetBeans by giving Project Name as DBTest,  
selected Ruby Platform as Ruby 1.8.6-p111, server as Mongrel 1.1.5 and  
in DataBase Configuration by selecting Specify Database Information  
Directly (Database Adapter as mysql, DataBase Name as  
DBTest\_development, User Name as root ) .

And i Have 2 Model Classes : Book and Subject  
My Book.rb class :

class Book \< ActiveRecord::Base  
belongs\_to :subject  
validates\_presence\_of :title  
validates\_numericality\_of :price, :message=\>“Error Message”  
end

And my subject.rb class

class Subject \< ActiveRecord::Base  
end

And i created Migration classes for Book and Subject

20090423224145\_books.rb file:

class Books \< ActiveRecord::Migration  
def self.up  
create\_table :books do |t|  
t.string :title, :limit =\> 32, :null =\> false  
t.float :price  
t.integer :subject\_id  
t.text :description  
t.timestamp :created\_at  
end  
end

def self.down  
end  
end

20090423224238\_subjects.rb file:

class Subjects \< ActiveRecord::Migration  
def self.up  
create\_table :subjects do |t|  
t.string :name  
end  
Subject.create :name =\> “Physics”  
Subject.create :name =\> “Mathematics”  
Subject.create :name =\> “Chemistry”  
Subject.create :name =\> “Psychology”  
Subject.create :name =\> “Geography”  
end

def self.down  
end  
end

And Now i am trying to create ths Tables from NetBeans by right clicking  
on the project, selecting Run/Debug Rake Task(DB Test). And in that  
Dialog box i selected db:create…

Now i am getting the error massege saying

Couldn’t create database for {“reconnect”=\>false, “encoding”=\>“utf8”,  
“username”=\>“root”, “adapter”=\>“mysql”, “host”=\>“localhost”,  
“password”=\>“root”, “database”=\>“DBTest\_development”, “pool”=\>5},  
charset: utf8, collation: utf8\_general\_ci (if you set the charset  
manually, make sure you have a matching collation)

Can any one help me to solve this problem. Please let me know how to  
solve ths. Your response is highly appreciated

---

<div class="post-metadata">

**Author:** ![lakshmi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ea5d25/32.png) [@lakshmi](https://www.ruby-forum.com/u/lakshmi)\
**Post date:** [April 24, 2009, 4:33am UTC](https://www.ruby-forum.com/t/problem-while-connecting-to-mysql-from-netbeans/166337/2 "2009-04-24T04:33:05Z")

</div>

On Thu, Apr 23, 2009 at 6:33 PM, Lakshmi K.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> manually, make sure you have a matching collation)

1. confirm that you can connect to MySQL manually using that  
username and password
2. check your mysql logs (if you’re not logging, configure that)
3. run the rake task from the command line

That should get you started 🙂

–  
Hassan S. ------------------------ removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![lakshmi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ea5d25/32.png) [@lakshmi](https://www.ruby-forum.com/u/lakshmi)\
**Post date:** [April 24, 2009, 5:59am UTC](https://www.ruby-forum.com/t/problem-while-connecting-to-mysql-from-netbeans/166337/3 "2009-04-24T05:59:46Z")

</div>

Hassan S. wrote:

> On Thu, Apr 23, 2009 at 6:33 PM, Lakshmi K.  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > manually, make sure you have a matching collation)
> 
> 1. confirm that you can connect to MySQL manually using that  
> username and password
> 2. check your mysql logs (if you’re not logging, configure that)
> 3. run the rake task from the command line
> 
> That should get you started 🙂
> 
> –  
> Hassan S. ------------------------ removed\_email\_address@domain.invalid

Hi Hassan thanks for your response.  
Actually every thing is working fine from command line. I can even start  
my MYSQL server and run rake tasks.

And even its working fine if i am using Built-in JRuby1.1.4(Ruby  
Platform)and server as GlassFish V3 or WEBrick from NETBeans.

But i am faceing this problem when i am using Ruby 1.8.6-p111(Ruby  
Platform) and server as WEBrick or Mongrel 1.1.5.

Any Idea why it is hapenning only for Ruby 1.8.6-p111 server? Do i need  
to do any setting in Netbeans? I can see correct details even in  
database.yml file.

Please let me know if you have any idea. Your response is highly  
appreciated

---

<div class="post-metadata">

**Author:** ![lakshmi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ea5d25/32.png) [@lakshmi](https://www.ruby-forum.com/u/lakshmi)\
**Post date:** [April 24, 2009, 11:10am UTC](https://www.ruby-forum.com/t/problem-while-connecting-to-mysql-from-netbeans/166337/4 "2009-04-24T11:10:00Z")

</div>

On Apr 24, 2009, at 5:59 AM, Lakshmi K. wrote:

> Any Idea why it is hapenning only for Ruby 1.8.6-p111 server? Do i  
> need  
> to do any setting in Netbeans? I can see correct details even in  
> database.yml file.
> 
> Please let me know if you have any idea. Your response is highly  
> appreciated

Try to install the rubygems native mysql gem:

sudo gem install mysql

---

<div class="post-metadata">

**Author:** ![lakshmi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ea5d25/32.png) [@lakshmi](https://www.ruby-forum.com/u/lakshmi)\
**Post date:** [April 24, 2009, 4:07pm UTC](https://www.ruby-forum.com/t/problem-while-connecting-to-mysql-from-netbeans/166337/5 "2009-04-24T16:07:03Z")

</div>

On Thu, Apr 23, 2009 at 8:59 PM, Lakshmi K.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Actually every thing is working fine from command line. I can even start  
> my MYSQL server and run rake tasks.

rake tasks that access the DB?

> And even its working fine if i am using Built-in JRuby1.1.4

Uh, what? So you were able to create the database using JRuby?  
Then running `rake db:create` again is bound to fail, right?

Maybe you can restate the exact nature of the problem. And if it’s  
still database-related, include the relevant entry from the MySQL log.

–  
Hassan S. ------------------------ removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![lakshmi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ea5d25/32.png) [@lakshmi](https://www.ruby-forum.com/u/lakshmi)\
**Post date:** [April 24, 2009, 9:06pm UTC](https://www.ruby-forum.com/t/problem-while-connecting-to-mysql-from-netbeans/166337/6 "2009-04-24T21:06:46Z")

</div>

On Fri, Apr 24, 2009 at 11:08 AM, Lakshmi K.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> but i am faceing the error “Client does not support authentication  
> protocol requested by server; consider u grading MySQL client”

It sounds like your mysql gem built against very old client libraries  
(3.x,4.0.x) but you’re trying to access a newer server.

I have no idea how to fix that on a Windows box, though. Sorry.

–  
Hassan S. ------------------------ removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![lakshmi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ea5d25/32.png) [@lakshmi](https://www.ruby-forum.com/u/lakshmi)\
**Post date:** [April 24, 2009, 8:08pm UTC](https://www.ruby-forum.com/t/problem-while-connecting-to-mysql-from-netbeans/166337/7 "2009-04-24T20:08:44Z")

</div>

Hassan S. wrote:

> On Thu, Apr 23, 2009 at 8:59 PM, Lakshmi K.  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Actually every thing is working fine from command line. I can even start  
> > my MYSQL server and run rake tasks.
> 
> rake tasks that access the DB?
> 
> > And even its working fine if i am using Built-in JRuby1.1.4
> 
> Uh, what? So you were able to create the database using JRuby?  
> Then running `rake db:create` again is bound to fail, right?
> 
> Maybe you can restate the exact nature of the problem. And if it’s  
> still database-related, include the relevant entry from the MySQL log.
> 
> –  
> Hassan S. ------------------------ removed\_email\_address@domain.invalid

Hi Thanks for your response.

I tried giving gem install mysql. mysql got installed but with one  
error. Please see the trace below.

C:\Group\>gem install mysql  
Successfully installed mysql-2.7.3-x86-mswin32  
1 gem installed  
Installing ri documentation for mysql-2.7.3-x86-mswin32…  
Installing RDoc documentation for mysql-2.7.3-x86-mswin32…  
ERROR: While generating documentation for mysql-2.7.3-x86-mswin32  
… MESSAGE: Unhandled special: Special: type=17, text=“”  
… RDOC args: --op  
c:/ruby/lib/ruby/gems/1.8/doc/mysql-2.7.3-x86-mswin32/rdoc -  
-exclude ext --main README --quiet ext README docs/README.html --title  
mysql-2.7  
.3-x86-mswin32 Documentation  
(continuing with the rest of the installation)

then i gave rake db:migrate command

C:\Group\>rake db:migrate --trace  
(in C:/Group)  
\*\* Invoke db:migrate (first\_time)  
\*\* Invoke environment (first\_time)  
\*\* Execute environment  
\*\* Execute db:migrate  
rake aborted!  
Client does not support authentication protocol requested by server;  
consider u  
grading MySQL client

c:/ruby/lib/ruby/1.8/mysql.rb:453:in `read' c:/ruby/lib/ruby/1.8/mysql.rb:130:in `real\_connect’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active\_record/connection\_  
dapters/mysql\_adapter.rb:576:in `connect' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_ dapters/mysql_adapter.rb:204:in `initialize’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active\_record/connection\_  
dapters/mysql\_adapter.rb:76:in `new' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_ dapters/mysql_adapter.rb:76:in `mysql\_connection’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active\_record/connection\_  
dapters/abstract/connection\_pool.rb:223:in `send' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_ dapters/abstract/connection_pool.rb:223:in `new\_connection’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active\_record/connection\_  
dapters/abstract/connection\_pool.rb:245:in `checkout_new_connection' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_ dapters/abstract/connection_pool.rb:188:in `checkout’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active\_record/connection\_  
dapters/abstract/connection\_pool.rb:184:in `loop' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_ dapters/abstract/connection_pool.rb:184:in `checkout’  
c:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_ dapters/abstract/connection_pool.rb:183:in `checkout’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active\_record/connection\_  
dapters/abstract/connection\_pool.rb:98:in `connection' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_ dapters/abstract/connection_pool.rb:326:in `retrieve\_connection’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active\_record/connection\_  
dapters/abstract/connection\_specification.rb:123:in  
`retrieve_connection' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_ dapters/abstract/connection_specification.rb:115:in `connection’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active\_record/migration.r  
:435:in `initialize' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.r :400:in `new’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active\_record/migration.r  
:400:in `up' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.r :383:in `migrate’  
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/tasks/databases.rake:116  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `call' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `execute’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `execute’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:in  
`invoke_with_call_ hain' c:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in  
`invoke_with_call_ hain' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:in `invoke’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2027:in  
`invoke_task' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `top\_level’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `top\_level’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in  
`standard_excepti n_handling' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1999:in `top\_level’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1977:in `run' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in `standard\_excepti  
n\_handling’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1974:in `run' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake:31 c:/ruby/bin/rake:19:in `load’  
c:/ruby/bin/rake:19

but i am faceing the error “Client does not support authentication  
protocol requested by server; consider u grading MySQL client”

can any one please help me in solving this error? Thanks in advance.
