Forum: Ruby .yml/host: localhost fails in Rails app generation

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9a830cb42e972717b75f67f604304ed1?d=identicon&s=25 NoOne (Guest)
on 2005-11-17 22:23
(Received via mailing list)
I'm running mysql  Ver 14.12 Distrib 5.0.15, for Win32 (ia32) on a
WinXP/SP2
system.

I'm trying to build the Depot application described in Chap. 5 of Agile
Web
Dev. w. Rails, (c) 2005.

The generated database.yml file in depot\config contains several entries
of
"socket: /path/to/your/mysql.sock".  I couldn't find an "mysql.sock"
file
anywhere  on my system.

Thomas' depiction of the .yml file includes the line "host: localhost"
instead,  so I made the switch to that instead of the "socket: ...:"
entry.

Following Thomas' lead, I ran the cmd "ruby script/generate scaffold
Product
Admin".  It ran fine until it reported "Client does not support
authentication protocol requested by server; consider upgrading MySQL
client".  Other Rails examples have worked fine, so I don't believe any
upgrade will solve my problem.

Any ideas how I can get around this roadblock?
9a830cb42e972717b75f67f604304ed1?d=identicon&s=25 NoOne (Guest)
on 2005-11-17 22:59
(Received via mailing list)
> Other Rails examples have worked fine, so I don't believe any upgrade will
> solve my problem.

Woops.  I should have said other apps, like MySQL-Front seem to connect
to
MySQL fine,  so I don't think upgrading MySQL is a solution.  More
importantly,  the version I'm running is, to the best of my knowledge,
the
current release version.

Incidentally,  Rails runs fine for other  (non-database) examples.  And
the
Rails version was installed only a week or two ago,  so I imagine it's
current, as well.
9a830cb42e972717b75f67f604304ed1?d=identicon&s=25 NoOne (Guest)
on 2005-11-17 23:15
(Received via mailing list)
Poking around the 'Net to resolve this problem, I discovered that Gem
could
be used to install MySQL.

So I uninstalled my current ver. and am installing under Gem.  I'll post
"success" if that clears up my problem.

Also,  I have a password on the root user.  Some have suggested that
might
be problematic.  But I pass the pswd in on the .yml file, so hopefully
that's not the cause of my problem.'
457cf540784a12ba2f30e06565a2c189?d=identicon&s=25 hgs (Guest)
on 2005-11-18 01:13
(Received via mailing list)
On Fri, 18 Nov 2005, Richard Lionheart wrote:

> The generated database.yml file in depot\config contains several entries of
> "socket: /path/to/your/mysql.sock".  I couldn't find an "mysql.sock" file
> anywhere  on my system.

Maybe because it issn't a file?

srwxrwxrwx   1 mysql    staff          0 Nov 11 18:07 /tmp/mysql.sock
srwxrwxrwx   1 mysql    staff          0 Nov 11 18:07 /tmp/mysql4.sock

man ls gives:
     d	   The entry is	a directory.
     [...]
     s	   The entry is	an AF_UNIX address family socket.

in the find man page:
     -type c
	   True	if the type of the file	is c, where c is b, c, d,
	   D,  f,  l,  p,  or s	for block special file,	character
	   special file, directory, door,  plain  file,	 symbolic
	   link, fifo (named pipe), or socket, respectively.

And [cf your later message] don't put the MySQL root password in the
yaml file, it gives those snooping too much power over your
databases.

        HTH
        Hugh
9a830cb42e972717b75f67f604304ed1?d=identicon&s=25 NoOne (Guest)
on 2005-11-18 04:05
(Received via mailing list)
Hi Hugh,

Thanks for responding:

> Maybe because it isn't a file?

Good point!   I assume you didn't notice that I running on
WindowsXP/SP2. I
didn't think of it,  but I do know some of Windows' stuff isn't
reflected in
file system (toolbars and menus come to mind).  I'll think harder about
how
I can expose sockets that are defined on my system

> srwxrwxrwx   1 mysql    staff          0 Nov 11 18:07 /tmp/mysql.sock
> srwxrwxrwx   1 mysql    staff          0 Nov 11 18:07 /tmp/mysql4.sock

It appears that in Unices, sockets are reflected in the file system even
though they're not amenable to ordinary file operations such as append
and
copy & pastel

> And [cf your later message] don't put the MySQL root password in the
> yaml file, it gives those snooping too much power over your
> databases.

Right now,  I was just trying to see if I can get stuff working.  I'll
take
the passwords out of there if I ever get Rails talking to databases.

One glimmer of hope was just dashed when I uninstalled MySQL in favor of
a
gem install of it.  That failed and I didn't see any easy solution.

I reinstalled MySQL with the hope that one other idea might pan out,
i.e.
using the hard-coded address rather than the symbolic localhost.  One
web
posting suggested that Rails treats the symbol differently than the
127.....

Again,  thanks for weighing in.  I hope some Windows guy dials in with
some
success story.

Regards,
Richard
2a0f7bd2c54fbc44329d69555b96f1c5?d=identicon&s=25 kevin.jackson (Guest)
on 2005-11-18 11:19
(Received via mailing list)
Ok, I missed the first part, but I'm guessing this is Rails related

here's a database.yml file segment from a windows rails app

development:
  adapter: mysql
  database: depot_development
  socket: /path/to/your/mysql.sock
  username: root
  password: password

This is what I'm using (MySQL 4.1.x), Rails 0.14.3 on windows and as you
see the socket points to nothing in particular.

I think your problem is that you are on MySQL 5 and that version changed
how it handled passwords etc and I think the client driver that comes
with One-click installer (which as a windows user I assume you're using)
doesn't properly support the new server

google for

mysql5 authentication protocol

and you'll see a host of problems (mainly php related).

Easy fix is to install MySQL4 instead of 5 and then the Rails defaults
automagically work

Kev
9a830cb42e972717b75f67f604304ed1?d=identicon&s=25 NoOne (Guest)
on 2005-11-19 16:34
(Received via mailing list)
Hi Kev,

Thanks for weighing in on my problem.

Bottom line, problem solved:

I'm running on a WinXP/SP2 platform with MySQL 5.0.15
I Googled as you suggested (which I've been doing, but more vigorously
now).
Found a solution at
http://forums.mysql.com/read.php?45,25582,34721#msg-34721:
SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('mypswd');"

My yaml settings are:
development:
  adapter: mysql
  database: depot_dev
  host: localhost
  password: mypswd

Again, I appreciate you offering the solution of reverting to MySQL 4.x.
I
tried to avoid that because I wanted to be able to use the newer
features,
particularly transactions, in the app I intend to build with Rails
(after I
get done running tutorials).

Best wishes,
Richard
This topic is locked and can not be replied to.