Problem with rails environment with cygwin...mysql doesn't

I have rails 1.2.2, ruby 1.8, mysql 5 and Rad Rails in my win XP and this stack works fine.

But I'm trying to use rails 2.1, mongrel, capistrano, git, mysql all in cygwin and e Text Editor.The only think that doesn't work is mysql.I installed this app from the source(in version 5.0.45, ./configure then make install).All right, but when I try to launch this error occurs:

"can't connect to local Mysql Server through socket '/tmp/mysql.sock'"

Bellow, my mysql options in my.cnt

[client] port = 3306 socket = /var/tmp/mysql.sock

[mysqld] port = 3306 socket = /var/tmp/mysql.sock datadir = /usr/local/mysql/data

Why this kind of problem happen? Many post in others forum about this problem don't help me

Rest only this detail for I'll use rails 2.1

Thank's for help me

I'm not a CygWin expert, but I would expect that since your error message is saying that "'/tmp/mysql.sock'" can't be found, but both your config files point to "'/var/tmp/mysql.sock'", the mysql command you are running is using some different config file. You need to search and find another config file for MySQL and see if it is pointing to the first version - if so, then that's the config file that you need to update to point to the second version.

You know that you can run all these things on XP without CygWin, right?

c.

Bruno Moura wrote:

I'm not a CygWin expert, but I would expect that since your error message is saying that "'/tmp/mysql.sock'" can't be found, but both your config files point to "'/var/tmp/mysql.sock'", the mysql command you are running is using some different config file. You need to search and find another config file for MySQL and see if it is pointing to the first version - if so, then that's the config file that you need to update to point to the second version.

You know that you can run all these things on XP without CygWin, right?

Craig White wrote:

Craig White wrote: >> I'm not a CygWin expert, but I would expect that since your error >> message is saying that "'/tmp/mysql.sock'" can't be found, but both your >> config files point to "'/var/tmp/mysql.sock'", the mysql command you are >> running is using some different config file. You need to search and find >> another config file for MySQL and see if it is pointing to the first >> version - if so, then that's the config file that you need to update to >> point to the second version. >> >> You know that you can run all these things on XP without CygWin, right? > ---- > I didn't think that you could use sockets on windows but rather had to > use port 3306 for mysql > > Craig

He installed mySQL within Cygwin (posix) from source, so if he's running under Cygwin he'd be using sockets just like on any other *nix.

I think. :wink:

I'm not a CygWin expert, but I would expect that since your error message is saying that "'/tmp/mysql.sock'" can't be found, but both
your config files point to "'/var/tmp/mysql.sock'", the mysql command you
are running is using some different config file. You need to search and
find another config file for MySQL and see if it is pointing to the first version - if so, then that's the config file that you need to update
to point to the second version.

Rails's database.yml ? I believe the default docket is /tmp/mysql.sock

Fred

Frederick Cheung wrote:

Bruno -

Based on Fred's earlier note, I would go back to your original my.cnt file (as shown in OP) and then just add this line in your application's database.yml file for each environment:

socket: /var/tmp/mysql.sock

Fred pointed out that it looked as if your error was related to Rails app looking in the wrong place for the socket, so adding that line above will match up the Rails app with what your original my.cnt was showing and hopefully all will be well.

Cayce Balara wrote:

Bruno -

Based on Fred's earlier note, I would go back to your original my.cnt file (as shown in OP) and then just add this line in your application's database.yml file for each environment:

socket: /var/tmp/mysql.sock

Fred pointed out that it looked as if your error was related to Rails app looking in the wrong place for the socket, so adding that line above will match up the Rails app with what your original my.cnt was showing and hopefully all will be well.

But i'm trying to connect to mysql without rails first, i want just use mysql command line in the same way than I use in windows.I beliave that when mysql works fine in cygwin, rails applications will be work fine too.

Thanks for one more time, but the problem still alive....rsssss

But i'm trying to connect to mysql without rails first, i want just use mysql command line in the same way than I use in windows.I beliave that when mysql works fine in cygwin, rails applications will be work fine too.

Thanks for one more time, but the problem still alive....rsssss

Punt CygWin.

http://dev.mysql.com/downloads/mysql/5.0.html#win32

Windows Essentials - one-click installer, easy configuration after install and boom you're up and running.

HI Bruno,

In my experience, even though Cygwin is “supposed” to have sockets, it’s still running on top of Win32, and mysql is one instance where the sockets are difficult to configure.

Even after you install Mysql-Windows.msi (which I strongly recommend you take this route), then you have two connection choices:

  1. mysql -h 127.0.0.1

  2. add ‘local’ to /etc/hosts like this :

127.0.0.1 localhost local

Then this works

$ mysql -h local

Then your database.yml will have

login: &login`
`  adapter: mysql`
`  username: username`

`  password: password`
`  host: `local
``
`development:`
`  <<: *login`
`  database: app_dev`
``
`

On the other hand, VMWare Server (free) and Ubuntu (free) are wonderful alternatives :slight_smile:

------------------------------

Thank's so much Peter!

But I have now this error

ERROR 2005 (HY000): Unknown MySQL server host 'local' (1)

So , when I try start the server another drug :

PC@BERAS:mysql$ ./mysql.server start Starting MySQL..../mysql.server: line 159: kill: (3208) - No such process ERROR!

I'll forgive use cygwin for Rails development,

In the end of tunnel Ubuntu stay waiting....rssssss

I'll use instant rails and mysql on windows

For cygwin you forgot to add ‘local’ to /etc/hosts $ vi /etc/hosts ==> append ‘local’ to the 127.0.0.1 line $ cat /etc/hosts 127.0.0.1 localhost local IPV6 …

No, I do this

It's possible to rails rails installed over cywin access mysql under windows?

Peter Fitzgibbons wrote:

I attempted to set this up at work for a developer environment , I noticed some funky things. Like cygwin would use the mysql libs but it would actually connect to the mysql windows install. I could not get it to work unless i installed mysql for windows, and even then it had to be running in the background. I never really figured out the reason for this but i couldn't really spend the ammount of time on it that i needed to to figure it out. If you are attempting to run a Linux like dev environment in windows i'd go with VM ware or some sort of VM solution. Even then i just went with putty/ssh + vim on a real linux box.