My rails app is complaining that it can't find mysql.sock in /tmp after upgrading. Before the defaults just worked. Now it appears that it is in /opt/local/var/run/mysql5 - so I either have to set it in my.cnf or change my rails configuration. -bakki
On May 2, 2007, at 10:53, Bakki Kudva wrote:
My rails app is complaining that it can't find mysql.sock in /tmp after upgrading. Before the defaults just worked. Now it appears that it is in /opt/local/var/run/mysql5 - so I either have to set it in my.cnf or change my rails configuration.
The MacPorts MySQL socket has never been in /tmp, to the best of my knowledge. The official binary distribution of MySQL from http:// dev.mysql.com does use that location, however. When using the MacPorts php5 port with the MacPorts mysql5 port, they "just work." PHP knows where the MySQL socket is. I don't use Ruby, but I would have hoped that MacPorts Ruby would also "just work" with MacPorts MySQL.
On 3.5.2007, at 10.47, Ryan Schmidt wrote:
On May 2, 2007, at 10:53, Bakki Kudva wrote:
My rails app is complaining that it can't find mysql.sock in /tmp after upgrading. Before the defaults just worked. Now it appears that it is in /opt/local/var/run/mysql5 - so I either have to set it in my.cnf or change my rails configuration.
The MacPorts MySQL socket has never been in /tmp, to the best of my knowledge. The official binary distribution of MySQL from http:// dev.mysql.com does use that location, however.
When using the MacPorts php5 port with the MacPorts mysql5 port, they "just work." PHP knows where the MySQL socket is. I don't use Ruby, but I would have hoped that MacPorts Ruby would also "just work" with MacPorts MySQL.
Perhaps the rail app can be told to make use of mysql_config (/opt/ local/bin/mysql_config5) that knows the socket location (as follows): jwa@messiaen:tmp> mysql_config5 Usage: /opt/local/bin/mysql_config5 [OPTIONS] Options: --cflags [-I/opt/local/include/mysql5/mysql] --include [-I/opt/local/include/mysql5/mysql] --libs [-L/opt/local/lib/mysql5/mysql - lmysqlclient -L/opt/local/lib -lz -lm -L/opt/local/lib -lssl -lcrypto] --libs_r [-L/opt/local/lib/mysql5/mysql - lmysqlclient_r -L/opt/local/lib -lz -lm -L/opt/local/lib -lssl - lcrypto] --socket [/opt/local/var/run/mysql5/mysqld.sock] --port [3306] --version [5.0.37] --libmysqld-libs [-L/opt/local/lib/mysql5/mysql -lmysqld -L/ opt/local/lib -lz -lm -L/opt/local/lib -lssl -lcrypto] jwa@messiaen:tmp> mysql_config5 --socket /opt/local/var/run/mysql5/mysqld.sock jwa@messiaen:tmp> ! ! Jyrki Wahlstedt ! skype:jyrkiwahlstedt ! http://www.wahlstedt.fi/jyrki/ ! ! Our life is no dream; but it ought to become one and perhaps will. ! PGP key ID: 0x139CC386 fingerprint: F355 B46F 026C B8C1 89C0 A780 6366 EFD9 139C C386
I am stumped now because the same upgrade on a MacBookPro seems to work fine. So something went awry when I upgraded the iMac. I just did a port -u update and didn't get any errors. -bakki On 5/3/07, Ryan Schmidt <ryandesign@macports.org> wrote:
The MacPorts MySQL socket has never been in /tmp, to the best of my knowledge. The official binary distribution of MySQL from http:// dev.mysql.com does use that location, however.
When using the MacPorts php5 port with the MacPorts mysql5 port, they "just work." PHP knows where the MySQL socket is. I don't use Ruby, but I would have hoped that MacPorts Ruby would also "just work" with MacPorts MySQL.
Thanks Jyrki for the suggestion. I'll try and see if it works. bakki On 5/3/07, Jyrki Wahlstedt <jwa@macports.org> wrote:
Perhaps the rail app can be told to make use of mysql_config (/opt/ local/bin/mysql_config5) that knows the socket location (as follows): jwa@messiaen:tmp> mysql_config5 Usage: /opt/local/bin/mysql_config5 [OPTIONS] Options: --cflags [-I/opt/local/include/mysql5/mysql] --include [-I/opt/local/include/mysql5/mysql] --libs [-L/opt/local/lib/mysql5/mysql - lmysqlclient -L/opt/local/lib -lz -lm -L/opt/local/lib -lssl -lcrypto] --libs_r [-L/opt/local/lib/mysql5/mysql - lmysqlclient_r -L/opt/local/lib -lz -lm -L/opt/local/lib -lssl - lcrypto] --socket [/opt/local/var/run/mysql5/mysqld.sock] --port [3306] --version [5.0.37] --libmysqld-libs [-L/opt/local/lib/mysql5/mysql -lmysqld -L/ opt/local/lib -lz -lm -L/opt/local/lib -lssl -lcrypto] jwa@messiaen:tmp> mysql_config5 --socket /opt/local/var/run/mysql5/mysqld.sock jwa@messiaen:tmp>
! ! Jyrki Wahlstedt ! skype:jyrkiwahlstedt ! http://www.wahlstedt.fi/jyrki/ ! ! Our life is no dream; but it ought to become one and perhaps will. ! PGP key ID: 0x139CC386 fingerprint: F355 B46F 026C B8C1 89C0 A780 6366 EFD9 139C C386
On May 5, 2007, at 22:02, Bakki Kudva wrote:
On 5/3/07, Ryan Schmidt wrote:
The MacPorts MySQL socket has never been in /tmp, to the best of my knowledge. The official binary distribution of MySQL from http:// dev.mysql.com does use that location, however.
When using the MacPorts php5 port with the MacPorts mysql5 port, they "just work." PHP knows where the MySQL socket is. I don't use Ruby, but I would have hoped that MacPorts Ruby would also "just work" with MacPorts MySQL.
I am stumped now because the same upgrade on a MacBookPro seems to work fine. So something went awry when I upgraded the iMac. I just did a port -u update and didn't get any errors.
Perhaps on one machine you have a my.cnf file and on the other you don't? Or you have my.cnf files on both machines but they contain different instructions?
On May 5, 2007, at 10:02 PM, Bakki Kudva wrote:
I am stumped now because the same upgrade on a MacBookPro seems to work fine. So something went awry when I upgraded the iMac. I just did a port -u update and didn't get any errors.
I had the same problem - rails works fine on one machine, and is looking for the MySQL socket in /tmp/mysql.sock on another after updating. I haven't been able to figure out what the difference is. There are a number of ways to work around this: 1. adding the socket to database.yml - I didn't want to do this, because it's not the same on all my servers. 2. use 127.0.0.1 instead of localhost for the address, which forces uses of TCP/IP instead of sockets - I didn't want to do this because there are probably performance issues, or 3 create a link in the /tmp directory that points to the correct location (mine is in /opt): $ ln -s /opt/local/var/run/mysql5/mysqld.sock /tmp/mysql.sock however, I suspect this may be removed by any number of cleanup routines, including a restart, so it might need to be recreated occasionally. Still, for me this seems like the best option. There may be something about Rails or its configuration that could cause this issue - if I figure it out, I'll post it. Good luck, SR
On May 5, 2007, at 9:02 PM, Bakki Kudva wrote:
I just did a port -u update and didn't get any errors.
are you sure the mysql5 daemon is running? (try running "ps aux | grep mysqld") if you really just did "port upgrade", its probably still the mysql4 daemon running on the envirnment thats working. if so, youll probably need to kill it manually with "sudo killall mysqld_safe" (assuming mysql4 was deactivated). then to setup and start mysql5 (preserving your old databases under / opt/local/var/db/mysql): sudo mkdir -p /opt/local/var/db/mysql5 sudo chown -R mysql:mysql /opt/local/var/db/mysql5 sudo -u mysql mysql_install_db5 sudo chown -R mysql:mysql /opt/local/var/run/mysql5 sudo -v sudo mysqld_safe5 & and set root pw with: mysqladmin5 -u root password '<secret>' mysqladmin5 -u root -h localhost -p password '<secret>' you can then use mysql_dump & mysql_import (or rails magic) to recreate your databases from 4. -emory On May 6, 2007, at 1:00 AM, Steven Rogers wrote:
On May 5, 2007, at 10:02 PM, Bakki Kudva wrote:
I am stumped now because the same upgrade on a MacBookPro seems to work fine. So something went awry when I upgraded the iMac. I just did a port -u update and didn't get any errors.
I had the same problem - rails works fine on one machine, and is looking for the MySQL socket in /tmp/mysql.sock on another after updating. I haven't been able to figure out what the difference is.
There are a number of ways to work around this:
1. adding the socket to database.yml - I didn't want to do this, because it's not the same on all my servers.
2. use 127.0.0.1 instead of localhost for the address, which forces uses of TCP/IP instead of sockets - I didn't want to do this because there are probably performance issues, or
3 create a link in the /tmp directory that points to the correct location (mine is in /opt):
$ ln -s /opt/local/var/run/mysql5/mysqld.sock /tmp/mysql.sock however, I suspect this may be removed by any number of cleanup routines, including a restart, so it might need to be recreated occasionally. Still, for me this seems like the best option.
There may be something about Rails or its configuration that could cause this issue - if I figure it out, I'll post it.
Good luck,
SR
_______________________________________________ macports-users mailing list macports-users@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo/macports-users
On 5/7/07, Emory Smith <emory.smith@gmail.com> wrote:
are you sure the mysql5 daemon is running? (try running "ps aux | grep mysqld")
Yes it is running and I can connect to it form the command line.
if you really just did "port upgrade", its probably still the mysql4 daemon running on the envirnment thats working.
This machine never had mysql4, so it was an upgrade from a previous 5.x.x version.
if so, youll probably need to kill it manually with "sudo killall mysqld_safe" (assuming mysql4 was deactivated).
Since the upgrade i had to reboot the machine because of an apple security update so correct daemon is running...also I did deactivate and uninstall the previous version. I can set the socket path in Rails databases.yml file but when this gets checked into subversion all the other machines which are running fine with socket at /tmp will have problems. So I guess I will have to tell mysql5 to use /tmp for socket by setting the my.conf file. The strange thing though is that the same setup (no my.cnf and the same versions of mysql5 and the rails app) is working fine on my MacbookPro. Before I set the my.conf file I just want to understand what's going on...right now it is not knowing that's bothering me. -bakki
not sure what else to suggest ... youre sure none of the following exist on either box? /etc/my.cnf ~/.my.cnf /opt/local/etc/mysql5/my.cnf a diff of the result from mysql> show variables; should tell you whether its the configuration ... -e On May 7, 2007, at 10:14 AM, Bakki Kudva wrote:
On 5/7/07, Emory Smith <emory.smith@gmail.com> wrote:
are you sure the mysql5 daemon is running? (try running "ps aux | grep mysqld")
Yes it is running and I can connect to it form the command line.
if you really just did "port upgrade", its probably still the mysql4 daemon running on the envirnment thats working.
This machine never had mysql4, so it was an upgrade from a previous 5.x.x version.
if so, youll probably need to kill it manually with "sudo killall mysqld_safe" (assuming mysql4 was deactivated).
Since the upgrade i had to reboot the machine because of an apple security update so correct daemon is running...also I did deactivate and uninstall the previous version.
I can set the socket path in Rails databases.yml file but when this gets checked into subversion all the other machines which are running fine with socket at /tmp will have problems. So I guess I will have to tell mysql5 to use /tmp for socket by setting the my.conf file. The strange thing though is that the same setup (no my.cnf and the same versions of mysql5 and the rails app) is working fine on my MacbookPro. Before I set the my.conf file I just want to understand what's going on...right now it is not knowing that's bothering me.
-bakki
On 5/7/07, Emory Smith <emory.smith@gmail.com> wrote:
not sure what else to suggest ...
youre sure none of the following exist on either box?
That's ok, thank you very much for all the info. I got it working for now with a ln -s /opt/local/var/run/mysql5/mysqld.sock /tmp/mysql.sock With this link it works like a charm.. I am still trying to figure out the reason why it DOES work on Linux and MacbookPro without the link. On the Linux box I see that there is no /tmp/mysql.sock or a link. Instead on Debian Etch it is at /var/run/mysqld/mysqld.sock That's what it is set at in the /etc/mysql/my.cnf and debian.cnf I also know that Rails defaults to /tmp/mysql.sock without it being set to some other location in the database.yml file. Since the socket attriubute is not set it should default to /tmp/mysql.sock.
youre sure none of the following exist on either box?
/etc/my.cnf ~/.my.cnf /opt/local/etc/mysql5/my.cnf
They exist on the Debian boxes as I've mentioned above, but on the Macs the only my.cnf is in the ports distribution files. Not copied to any location.
a diff of the result from
mysql> show variables;
should tell you whether its the configuration ...
This is from Debian
| slow_launch_time | 2 | | socket | /var/run/mysqld/mysqld.sock | | sort_buffer_size | 2097144 | |
I'll do check tomorrow on the iMac which I am sure will be /opt/local/var/run/mysql5/mysqld.sock Thanks for your efforts :) -bakki
participants (5)
-
Bakki Kudva
-
Emory Smith
-
Jyrki Wahlstedt
-
Ryan Schmidt
-
Steven Rogers