luislavena / mysql-gem

MySQL/Ruby Bindings, wrapped as Gem with improved cross-platform support
http://rubyforge.org/projects/mysql-win
Other
53 stars 20 forks source link

Is MYSQL_OPT_PROTOCOL working/supported ? #28

Closed sathlan closed 9 years ago

sathlan commented 9 years ago

EDIT: there was a mistake in my code, all is well, and you can ignore this issue.

Hi,

I want my connection to bypass the local unix socket all the time, but when I use localhost it seems to not be taken into account. Here the code I use for testing. When using the "-l" options the connection doesn't work:

./test.rb  -l
./test.rb:14:in `connect': Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) (Mysql::Error)
        from ./test.rb:14:in `<main>'

given that my socket is in /run/mysql-default/mysqld.sock and that my default configuration file is /etc/mysql-default/my.cnf

My mysql.h on the platform (Ubuntu-Server 14.10) is

enum mysql_protocol_type 
{
  MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
  MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
};

I see that in your test that it's commented.

So is that option supported or working at all when using localhost ?

Environment:

Ruby:

  /opt/chef/embedded/bin/ruby --version
ruby 2.1.4p265 (2014-10-27 revision 48166) [x86_64-linux]

Mysql:

mysql --version
mysql  Ver 14.14 Distrib 5.6.19, for debian-linux-gnu (x86_64) using  EditLine wrapper

Mysql library:

libmysqlclient-dev                  5.5.40-0ubuntu1
ii  libmysqlclient18:amd64              5.5.40-0ubuntu1

Mysql Ruby library:

mysql (2.9.1)

on Ubuntu-Server 14.10.

sathlan commented 9 years ago

Hi,

sorry for the noise I made a mistake in my code. Everything is working as expected.

++