From: Jack Dempsey Date: 2001-12-14T14:07:12+09:00 Subject: [ruby-talk:28486] Re: mysql issues...looking for wrong socket "Daniel P. Zepeda" wrote: > Hmmm... Is it possible you have more than one version of MySQL installed? nope > In my /usr/include/mysql/mysql_version.h there is: > #define MYSQL_UNIX_ADDR "/var/lib/mysql/mysql.sock" > mine too...isn't this strange then: (taken from mysql.com) A MySQL client on Unix can connect to the mysqld server in two different ways: Unix sockets, which connect through a file in the file system (default `/tmp/mysqld.sock') right now mysql is not running...[jack@Zeus jack]$ ls -l /tmp total 24 -rw------- 1 jack jack 199 Dec 14 00:01 dcopOF6Ecv drwx------ 2 jack jack 4096 Dec 14 00:01 kde-jack drwx------ 2 jack jack 4096 Dec 14 00:02 ksocket-jack drwx------ 2 root root 4096 Dec 13 19:04 ksocket-root drwx------ 3 jack jack 4096 Dec 14 00:01 mcop-jack drwxr-xr-x 5 jack jack 4096 Dec 13 19:37 nscomm40-jack [jack@Zeus jack]$ however, after i start mysql with: safe_mysqld --user=root & and ls -l /tmp i see srwxrwxrwx 1 root root 0 Dec 14 00:11 mysql.sock (i know runnning as root's not too smart but as i said not a primary concern) i can login to mysql and look at the socket... mysql Ver 11.15 Distrib 3.23.41, for redhat-linux-gnu (i386) Connection id: 1 Current database: Current user: bot@localhost Current pager: stdout Using outfile: '' Server version: 3.23.41-log Protocol version: 10 Connection: Localhost via UNIX socket Client characterset: latin1 Server characterset: latin1 UNIX socket: /tmp/mysql.sock Uptime: 1 min 8 sec still looking around...perhaps i'm doing something really dumb... thanks for your help, jack > > Maybe doing a locate mysql_version.h would be enlightening. > > I'm not absolutely certain mysql-ruby uses these defines, I'd have to > look in the source code, but it seems a safe bet that since these switches > are there, that the headers are used, including finding where the socket is. > > Since it seems yours is not a multi-user system, it doesn't matter where the > socket is located, instead of recompiling MySQL I'd just try to get ruby to > find the socket properly. > > One last thought, I'm not sure if a link to a socket would work, I've never > tried it, but you might try doing a link from where it is in /tmp to where > Ruby is looking for it in /var/lib. It's a quick-and-dirty fix, if it works, > you're done, if it doesn't, you haven't wasted much time. > > On Fri, 14 Dec 2001 11:39:29 +0900 > "Jack Dempsey" wrote: > > > The daemon's definitely running....i of course tested out my normal command > > line connection and that was just fine...and if i ls /tmp i see "mysql.sock" > > I installed it and didn't change anything, so i don't know what could have > > happened... > > i agree its probably bad for security, but this is a dual boot machine > > that's not often up in linux...think i should recompile mysql and reinstall? > > i just don't think it'd change the tmp thing because i certainly didn't tell > > it to run the sockets in tmp..... > > > > jack > > > > -----Original Message----- > > From: Daniel P. Zepeda [mailto:daniel@zepeda-zone.net] > > Sent: Thursday, December 13, 2001 9:34 PM > > To: ruby-talk ML > > Subject: [ruby-talk:28477] Re: mysql issues...looking for wrong socket > > > > > > On any redhat system (and derivatives like mandrake) that I've ever worked > > on, MySQL creates the socket in /var/lib/mysql, just where Ruby is > > looking. Are you *sure* that you have the MySQL daemon running? Can you > > see the socket "file" in /tmp? If so, your administrator must have changed > > the default installation. From a security standpoint, making the socket in > > /tmp doesn't sound like a good idea. > > > > In any case, the socket file is defined in the MySQL include files, which > > the ruby module checks, so you shouldn't have to mess with this. > > > > I'll bet the daemon isn't running... > > > > > > On Fri, 14 Dec 2001 09:40:05 +0900 > > Jack Dempsey wrote: > > > > > hi all, > > > > > > i've got ruby 1.6.5 working well on redhat 7.2 and now i'd like to add > > > mysql support... > > > everything seems to work fine...it makes perfectly, but when i run > > > test.rb i get the following error > > > > > > [jack@Zeus mysql-ruby-2.4.1]$ ruby -I. ./test.rb localhost root password > > > > > > connect............../t/00connect.rb:1:in `connect': Can't connect to > > > local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) > > > (MysqlError) > > > from ./t/00connect.rb:1 > > > from ./test.rb:23:in `load' > > > from ./test.rb:23 > > > from ./test.rb:19:in `each' > > > from ./test.rb:19 > > > > > > mysql normally creates its sockets in /tmp so i can see how looking in > > > /var/lib... would be a problem...is there some way i can tell ruby to > > > look elsewhere, or perhaps recompile with a different option? > > > any help would be much appreciated.... > > > thanks! > > > jack dempsey > > > > > > > > > -- > > Daniel P. Zepeda > > daniel@zepeda-zone.net > > > > -- > Daniel P. Zepeda > daniel@zepeda-zone.net