# .yml/host: localhost fails in Rails app generation

**URL:** <https://www.ruby-forum.com/t/yml-host-localhost-fails-in-rails-app-generation/48223>\
**Category:** Ruby\
**Created:** [November 17, 2005, 10:23pm UTC](https://www.ruby-forum.com/t/yml-host-localhost-fails-in-rails-app-generation/48223 "2005-11-17T22:23:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoOne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ecae2f/32.png) [@NoOne](https://www.ruby-forum.com/u/NoOne)\
**Post date:** [November 17, 2005, 10:23pm UTC](https://www.ruby-forum.com/t/yml-host-localhost-fails-in-rails-app-generation/48223/1 "2005-11-17T22:23:32Z")

</div>

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, © 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?

---

<div class="post-metadata">

**Author:** ![NoOne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ecae2f/32.png) [@NoOne](https://www.ruby-forum.com/u/NoOne)\
**Post date:** [November 17, 2005, 10:59pm UTC](https://www.ruby-forum.com/t/yml-host-localhost-fails-in-rails-app-generation/48223/2 "2005-11-17T22:59:54Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![NoOne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ecae2f/32.png) [@NoOne](https://www.ruby-forum.com/u/NoOne)\
**Post date:** [November 17, 2005, 11:15pm UTC](https://www.ruby-forum.com/t/yml-host-localhost-fails-in-rails-app-generation/48223/3 "2005-11-17T23:15:09Z")

</div>

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.’

---

<div class="post-metadata">

**Author:** ![NoOne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ecae2f/32.png) [@NoOne](https://www.ruby-forum.com/u/NoOne)\
**Post date:** [November 18, 2005, 1:13am UTC](https://www.ruby-forum.com/t/yml-host-localhost-fails-in-rails-app-generation/48223/4 "2005-11-18T01:13:19Z")

</div>

On Fri, 18 Nov 2005, Richard L. 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
```

---

<div class="post-metadata">

**Author:** ![NoOne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ecae2f/32.png) [@NoOne](https://www.ruby-forum.com/u/NoOne)\
**Post date:** [November 18, 2005, 4:05am UTC](https://www.ruby-forum.com/t/yml-host-localhost-fails-in-rails-app-generation/48223/5 "2005-11-18T04:05:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![NoOne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ecae2f/32.png) [@NoOne](https://www.ruby-forum.com/u/NoOne)\
**Post date:** [November 19, 2005, 4:34pm UTC](https://www.ruby-forum.com/t/yml-host-localhost-fails-in-rails-app-generation/48223/6 "2005-11-19T16:34:23Z")

</div>

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:](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

---

<div class="post-metadata">

**Author:** ![NoOne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ecae2f/32.png) [@NoOne](https://www.ruby-forum.com/u/NoOne)\
**Post date:** [November 18, 2005, 11:19am UTC](https://www.ruby-forum.com/t/yml-host-localhost-fails-in-rails-app-generation/48223/7 "2005-11-18T11:19:31Z")

</div>

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
