How to install Ruby on Rails on Windows 7 - Part 3, MySQL connector

How to install Ruby on Rails on Windows 7 - Part 3, MySQL connector

Jonathan MacDonald

10 лет назад

29,789 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Gennady
Gennady - 31.12.2018 00:33

It's not working in my case (Ruby-2.3.3), mysql2 (0.5.2 x86-mingw32) when I do >rake db:create. I am getting: c:\row\dev\hello_world>rake db:create
Access denied for user 'root'@'localhost' (using password: YES)
Couldn't create 'hello_world_development' database. Please check your configuration.
rake aborted!
Mysql2::Error::ConnectionError: Access denied for user 'root'@'localhost' (using password: YES)

Ответить
00 7
00 7 - 11.09.2016 08:19

how come mine keep showing this ...c:/jruby/Ruby200/lib/ruby/gems/2.3.0/gems/mysql2-0.4.4-x86-mingw32/lib/mysql2/client.rb:87:in `connect': Access denied for user 'root'@'localhost' (using password: YES) (Mysql2::Error)
from c:/jruby/Ruby200/lib/ruby/gems/2.3.0/gems/mysql2-0.4.4-x86-mingw32/lib/mysql2/client.rb:87:in `initialize'
from test.rb:3:in `new'
from test.rb:3:in `<main>'


please help

Ответить
MilosCsrb
MilosCsrb - 08.04.2016 00:08

Why so much effort to install one program?

Ответить
Luis Taveras
Luis Taveras - 17.02.2016 15:31

Hi
I can't get Mysql to install. While installing I get the following message -Mysql Internal error object reference not set to an instance of an object the installer will now close. Any suggestions?

Ответить
Kevin Cowley
Kevin Cowley - 11.12.2015 00:51

Thank you for creating such great tutorials, sub'd and liked.

Ответить
Douglas Allen
Douglas Allen - 08.12.2015 06:05

I'm on Windows 10 and following. I had no problem with the test.rb like he did. But then I also had installed the msi version of the sql C connector but I'm not sure if that did anything. But libmsql.dll is in that lib dir of the program files mysql dir. And so I did put that mysql/bin on the PATH. But just do what he says and you should be fine. Sqlite was the same way back in the day. You might have to put that dll in the ruby bin.

Ответить
soumya dey
soumya dey - 28.11.2015 12:54

Hi i have followed this this but am getting this error, please help me out- {access denied for user 'root'@'localhost' (using password yes)}

Ответить
Wonderful Ireland
Wonderful Ireland - 05.11.2015 11:19

Hi Jonathan Thanks for grate tutorial i have issue could u pls tell me what can i do?
c:\row\dev\mysql_test>ruby test.rb
C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/mysql2-0.4.1-x86-mingw32/lib/mysql2/client.rb:79:in `connect': Unknown MySQL server host 'local' (0) (Mysql2::Error)
from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/mysql2-0.4.1-x86-mingw32/lib/mysql2/client.rb:79:in `initialize'
from test.rb:3:in `new'
from test.rb:3:in `<main>'

Ответить
Joe Cameron
Joe Cameron - 29.08.2015 00:15

In the step where we are finding the mysql.exe: What do i do if this is located on our work server, and it's not publicly available? I do have mySQL workbench setup on my station. Do I link through this? Or should I get access to the servers mysql section from our IT department?

Thanks for the awesome videos, can't wait to be riding on rails.

Ответить
Charles Yaafi
Charles Yaafi - 18.07.2015 21:24

Hi Jonathan, I need your HELP. I am having problems with this MySQL connector. I am using ruby 2.1 now and the error is as below:
DL is deprecated, please use Fiddle
C:/row/Ruby21/lib/ruby/gems/r.1,0/gems/mysql2-0.3.18/lib/mysql2/client.rb
 ‘connect’ :Lost connection to MySQL server at ‘waiting for initial communication packet’, system error: 0 (Mysql2::Error)
From c:/row/Ruby21/lib/ruby/gem/2.1.0/gem/mysql2-0.3.18/lib/mysql/client.rb:70:in ‘initialize’
      from test.rb:3:in ‘new’
       from test.rb:3:in ‘new’

Ответить
TomCaT ToM
TomCaT ToM - 30.06.2015 20:20

ok so after much piddling about I have uninstall ruby22 and now have ruby21....I have now got the TIMESTAMP :-) lets hope everything just WORKS from here on .... only spent 3-4 or maybe 5 days trying to get anything working ...

Ответить
Mats Fjellheim
Mats Fjellheim - 26.05.2015 00:27

To all of you having the problem with C:/row/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
: cannot load such file -- mysql2/2.2/mysql2 (LoadError, then you have installed Ruby 2.2, uninstall download ruby 2.1.6 it worked for me

Ответить
Swedegoalie5
Swedegoalie5 - 24.05.2015 20:46

Hi when testing the connector I cannot get it to work.
I am getting a load error on mysql2/2.2/mysql2. I ran the gem install but it didn't use the devkit when it installed. it said the install was successful but the output from the install said it installed the binary file. any help?

Ответить
John Clement
John Clement - 20.05.2015 10:04

For the command of typing "gem install mysql2...etc... "  Do we have to find the most recent mysql number instead of mysql2?  It says that the latest version is 5.7 on the website...

Ответить
shivam gupta
shivam gupta - 25.04.2015 17:34

getting this error even after added the path of connecter ->
C:/row/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
: cannot load such file -- mysql2/2.2/mysql2 (LoadError)
        from C:/row/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54
:in `require'
        from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x86-mingw32/li
b/mysql2/mysql2.rb:2:in `<top (required)>'
        from C:/row/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54
:in `require'
        from C:/row/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54
:in `require'
        from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x86-mingw32/li
b/mysql2.rb:31:in `<top (required)>'
        from C:/row/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:12
8:in `require'
        from C:/row/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:12
8:in `rescue in require'
        from C:/row/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39
:in `require'
        from test.rb:1:in `<main>'

Ответить
Christophe Ashworth
Christophe Ashworth - 16.04.2015 22:42

Is it possible I am unable to do the test because I have the version 2.2 ?

Ответить
Waleed Ahmad
Waleed Ahmad - 22.03.2015 14:42

Hi Jonathan,

Thanks for the awesome video. I am getting the following error(s) when trying to run the test.rb file:

C:\row\dev\mysql_test>ruby test.rb
C:/row/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
: cannot load such file -- mysql2/2.2/mysql2 (LoadError)
        from C:/row/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54
:in `require'
        from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x86-mingw32/li
b/mysql2/mysql2.rb:2:in `<top (required)>'
        from C:/row/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54
:in `require'
        from C:/row/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54
:in `require'
        from C:/row/Ruby22/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x86-mingw32/li
b/mysql2.rb:31:in `<top (required)>'
        from C:/row/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:12
8:in `require'
        from C:/row/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:12
8:in `rescue in require'
        from C:/row/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39
:in `require'
        from test.rb:1:in `<main>'

Ответить
mereum-
mereum- - 19.03.2015 18:25

after installing the gem
this is what I got: Successfully installed mysql2-0.3.18.-x86-mingw32
why is it x86. I followed step by step but different outcome. Please HELP.

Ответить
DarKyle182
DarKyle182 - 16.03.2015 22:20

Hey! well... im having some troubles on the last step of this video, it keeps callin this error 
c:\row\dev\mysql_test>ruby test.rb
c:/row/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
: cannot load such file -- mysql2/2.2/mysql2 (LoadError)
        from c:/row/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54
:in `require'

im kinda nervous because i need get started asap with ruby on rails, any help would be appreciated
Thx!

Ответить
Николай Димитров
Николай Димитров - 26.02.2015 10:58

I can not understand what went wrong ...
client = Mysql2::Client.new(host: 'localhost', username: 'root', password: 'fkjsdkjlksd')

C:\row\dev\mysql_test>ruby test.rb
DL is deprecated, please use Fiddle
C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.18-x86-mingw32/lib/mysql2/cli
ent.rb:70:in `connect': Access denied for user 'root'@'localhost'(using passwor
d: YES) (Mysql2::Error)
        from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.18-x86-mingw32/l
ib/mysql2/client.rb:70:in `initialize'
        from test.rb:3:in `new'
        from test.rb:3:in `<main>'

client = Mysql2::Client.new(host: 127.0.0.1, username: 'root', password: 'daksldklkask')

C:\row\dev\mysql_test>ruby test.rb
test.rb:3: no .<digit> floating literal anymore; put 0 before dot
...Mysql2::Client.new(host: 127.0.0.1, username: 'root', passwo...
...                               ^
test.rb:3: syntax error, unexpected tFLOAT, expecting '('
...ql2::Client.new(host: 127.0.0.1, username: 'root', password:...
...                                      ^

Ответить
O Connor
O Connor - 14.12.2014 23:39

Im getting an error about mysql2? when i try to install the Gem ? But i was able to log in with root and my passwd

Ответить
O Connor
O Connor - 14.12.2014 05:20

I have MYSQL Installed & found the Bin folder In Profile (x86) but it did not contain the Mysql.exe file . and the normal profile folder did contain Msql but not the Mysql server or a  Bin folder

Ответить
Mok
Mok - 04.12.2014 01:01

Yeah I just went back and validated I followed everything and I still get this:
c:\row\dev>cd mysql_test

c:\row\dev\mysql_test>ruby test.rb
c:/row/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
: cannot load such file -- mysql2 (LoadError)
        from c:/row/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55
:in `require'
        from test.rb:1:in `<main>'

c:\row\dev\mysql_test>ruby test.rb
c:/row/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
: cannot load such file -- mysql2 (LoadError)
        from c:/row/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55
:in `require'
        from test.rb:1:in `<main>'

c:\row\dev\mysql_test>

Ответить
Mok
Mok - 04.12.2014 00:45

johnatan,  I have followed your instructions to the letter and when I get to the part where I run the test.rb I receive the following error.  What could I have possibly missed?

c:\row\dev\mysql_test>ruby test.rb
c:/row/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
: cannot load such file -- mysql2 (LoadError)
        from c:/row/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55
:in `require'
        from test.rb:1:in `<main>'

c:\row\dev\mysql_test>

Ответить
D Mallon
D Mallon - 03.12.2014 15:37

Every time I try to install MySQL I get to the set up page and when choosing "Server Only" it returns the message "Unable to determine the products that correspond with that set up type" (It returns the same message regardless of which option I choose). Then when pressing next there is nothing to install.

Do you NEED MySQL to start learning Ruby on Rails? Are there any others that can be used? Or a fix for the above?

Thanks.

Ответить
Al Dankha
Al Dankha - 22.11.2014 05:04

THIS IS WHAT I GET WHEN I TRY GETTING THE TIMESTAMP.


c:\row\dev\mysql_test>ruby test.rb\
ruby: Invalid argument -- test.rb/ (LoadError)
c:\row\dev\mysql_test>ruby test.rb
C:/row/Ruby200/lib/ruby/gems/2.1.0/gems/mysql2-0.3.17/lib/mysql2/client.rb:70:in
 `connect': Access denied for user 'root'@'localhost'(using password: YES) (Mys
ql2::Error)
        from C:/row/Ruby200/lib/ruby/gems/2.1.0/gems/mysql2-0.3.17/lib/mysql2/cl
ient.rb:70:in `initialize'
        from test.rb:3:in `new'
        from test.rb:3:in `<main>'
c:\row\dev\mysql_test>

Ответить
Harshit Sharma
Harshit Sharma - 21.10.2014 15:47

Hi Jonathan ,I am getting the following error.Please help!
C:/row/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
: Incorrect MySQL client library version! This gem was compiled for 6.0.0 but th
e client library is 5.1.73. (RuntimeError)
        from C:/row/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55
:in `require'
        from C:/row/Ruby21/lib/ruby/gems/2.1.0/gems/mysql2-0.3.16/lib/mysql2.rb:
8:in `<top (required)>'
        from C:/row/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:13
5:in `require'
        from C:/row/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:13
5:in `rescue in require'
        from C:/row/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:14
4:in `require'
        from test.rb:2:in `<main>'
what is the solution.Please tell.

Ответить
Tantalum
Tantalum - 11.10.2014 07:31

noob here.  when I get to the end to run ruby test.rb i get the following error:
test.rb:3:in '<main>': undefined method 'client' for Mysql2:Module (NoMethodError)
(btw, how do i copy it from the command prompt?).  Any suggestions on this error?  thx

Ответить
Joao Medina
Joao Medina - 29.09.2014 22:55

Hello. I get this error in the end of the instructions in the video:

c:\row\dev\mysql_test>ruby test.rb
c:/row/Ruby200/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require
': Incorrect MySQL client library version! This gem was compiled for 6.0.0 but t
he client library is 5.1.73. (RuntimeError)

Wrong dll? How do I solve it? Thank you.

Ответить
GABRIEL LEAHY
GABRIEL LEAHY - 29.09.2014 09:11

I was fine till the end:

c:\row>cd dev

c:\row\dev>cd mysql_test

c:\row\dev\mysql_test>ruby test.rb
c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/mysql2-0.3.16/lib/mysql2/client.rb:70:in
`connect': Access denied for user 'gabeleahy'@'localhost'(using password: YES)
(Mysql2::Error)
        from c:/row/Ruby21/lib/ruby/gems/2.1.0/gems/mysql2-0.3.16/lib/mysql2/cli
ent.rb:70:in `initialize'
        from test.rb:3:in `new'
        from test.rb:3:in `<main>'

c:\row\dev\mysql_test>

Ответить
Sreeharissh V
Sreeharissh V - 25.08.2014 14:01

this is the error im getting! Please Help :(
c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/lib/mysql2/client.rb:70:in
 `connect': Can't connect to MySQL server on 'localhost' (10061) (Mysql2::Error)

        from c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/lib/mysql2/cl
ient.rb:70:in `initialize'
        from test.rb:3:in `new'
        from test.rb:3:in `<main>'

Ответить
Patrick Möller
Patrick Möller - 15.08.2014 15:16

Hi Jonathan, Thanks a lot for your Step by Step Instrucion Videos. They helped me a lot. By the way - Hint for all others: Make sure, your Antivirus-Tool is set off for installing the mysql connector. Oherwise it will only produce errors.

Ответить
Starctaft SCV
Starctaft SCV - 26.07.2014 22:04

для тебя отдельный котелок в аду

Ответить
Shyam Prasad
Shyam Prasad - 20.07.2014 12:50

Hard to get a tutorial like this by googling. All other tutorials are very unclear.

Ответить
Shyam Prasad
Shyam Prasad - 20.07.2014 12:49

Very simple and straightforward. You sir, are a lifesaver!

Ответить
Mcmendz
Mcmendz - 19.07.2014 00:43

What if you don't have MySQL install already, how do you install it ?

Ответить
Mayank Ladha
Mayank Ladha - 10.06.2014 15:27

Hi Jonathan!
On running the file test.rb, i am getting the following error message and i am not getting any way to move out from this. Please help...

C:\row\dev\mysql_test>ruby test.rb
C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/lib/mysql2/client.rb:70:in `connect'
: Can't connect to MySQL server on 'localhost' (10061) (Mysql2::Error)
        from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/lib/mysql2/client.rb:70
:in `initialize'
        from test.rb:3:in `new'
        from test.rb:3:in `<main>'

Ответить
David Chiu
David Chiu - 06.06.2014 20:18

Every step went fine, until the very end:
it appears like this

C:\row\dev\mysql_test>ruby test.rb
C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/lib/mysql2/client.rb:70:in
 `connect': Unknown MySQL server host 'local host' (0) (Mysql2::Error)
        from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/lib/mysql2/cl
ient.rb:70:in `initialize'
        from test.rb:3:in `new'
        from test.rb:3:in `<main>'

C:\row\dev\mysql_test>

*****************************
plz help :(

Ответить
smiley00341
smiley00341 - 26.04.2014 06:30

Do I have to create an online account for it to be able to log into?

Ответить
smiley00341
smiley00341 - 26.04.2014 06:25

I end up getting this >  from test.rb:5: in 'new'  from test.rb:5: in '<main>'  < ? Does this mean I made it work? lol because I did all the steps to fix the path and then install the mysql2 gem was installed . 

Ответить
Janck77
Janck77 - 26.04.2014 01:40

I did exactly the same as you and i keep getting this error: "You have to install development tools first."

Ответить
meghana leburi
meghana leburi - 04.04.2014 20:01

Hi when I am trying to set up I'm getting the following error. Please help me
C:\row\dev\mysql_test>ruby test.rb
C:/row/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in 'require' : cannot load such file -- mysql2 <LoasErrror>
from C:/row/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in 'require'
from test.rb:1:in '<main>'

Ответить