Issue 107391 - Connector/OOo tries socket connection even with "localhost" and Socket: blank
Summary: Connector/OOo tries socket connection even with "localhost" and Socket: blank
Alias: None
Product: Base
Classification: Application
Component: MySQL Connector/OOo (show other issues)
Version: OOo 3.1
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: dbaneedsconfirm
QA Contact: issues@dba
Depends on:
Reported: 2009-12-02 21:21 UTC by rene
Modified: 2012-09-09 06:08 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Note You need to log in before you can comment on or make changes to this issue.
Description rene 2009-12-02 21:21:36 UTC
[ follow-up from Issue 107246 ]

--- snip ---
I think we have two problems here. One is that C/C++ (Connector/C++, the C++
component for connecting to a MySQL server, which is used by C/OOo, the
extension) tries to connect via socket, though it's told to connect via host/port.
--- snip ---

Connecting via the MySQL Connector/OOo to a MySQL server on "localhost" always
makes the Connector to try via socket. Which might work or not, but does surely
not work from a chroot :). I didn't specify socket but just specified mysql as
db and localhost as host.

I think the Connector should either fall back to TCP then or not try socket auth
when we don't specify one.
Comment 1 Frank Schönheit 2009-12-16 12:11:48 UTC
- Installed vanilla OOo 3.1.0, on Linux 32 bit, installed C/OOo 1.0.0 final.
- Created a new database, using MySQL native connection, server "localhost",
  DB name "testdb"
- tried connecting to this database
=> error message "Can't connect to MySQL server on (111)"

Okay, I have no MySQL server running on localhost :). Can somebody confirm that
if you shut down your MySQL server running on localhost, then the error message
does not talk about sockets anymore?
Comment 2 Frank Schönheit 2009-12-16 12:22:35 UTC
Ah! Looking into the code of Connector/C, the lib underlying Connector/C++,
which in turn is used by Connector/OOo, there indeed is code which basically
looks like "if no protocol is specified, and we're connecting to localhost, then
use a socket".

So, the error here seems to be that C/C++ does not set the protocol to

I think I can fix this, but since my analysis is from code inspection only, it
might be wrong - anybody reading here who would be willing to test a new
extension version?
Comment 3 Frank Schönheit 2009-12-16 12:39:25 UTC, if somebody is
interested in ...
Comment 4 Frank Schönheit 2009-12-17 11:43:22 UTC
Tried again to reproduce the problem on a Linux system with a running MySQL
server - connected via localhost:3306 - no problem at all.

So, to me this boils down to "worksforme".

Can somebody of those who encountered the problem please check whether the
1.0.1.alpha, to which I pointed above, solves the problem? Thanks.
Comment 5 Frank Schönheit 2009-12-17 11:44:11 UTC
Or is it perhaps that the problem in general does not happen with the extension
from, but only
with a distro-specific extension?
Comment 6 Frank Schönheit 2010-01-04 08:42:51 UTC
ping. Mechtilde, rene: any chance to test whether the version from fixes the problem for you?
As said, I cannot reproduce it, so I cannot check whether this (supposed) fix
really works.

side note: I've been told this issue has been raised as potential stopper for
the 3.2 release. This is not necessary, since the bug is not in OOo code, but
really in the C/OOo code.
Comment 7 john.mccreesh 2010-01-04 10:32:01 UTC
"The extension 'MySQL Connector for (Alpha)' does not work on
this computer" - I guess because I'm running 64bit Ubuntu (could do with a more
explicit error message).

Issue 107794 is being proposed as a showstopper for 3.2. The proposed workround
is to use the MySQL Connector extension. However, if this is accepted as a
workround (still under debate), then getting 107391 fixed becomes a prerequisite
- hence a showstopper.
Comment 8 Frank Schönheit 2010-01-04 10:45:48 UTC
Yes, the version linked above is a Linux 32 bit version.

For the show-stopper-ness ... well, I am not sure "use C/OOo instead of C/ODBC"
is a valid workaround, since this migration to another connector requires some
work for affected databases (as mentioned in the issue I think).
Anyway, as said above, the fix is (probably) in Connector/C++, a third-party
component shipped with Connector/OOo, *not* in OOo code, so whether or not this
is a "stopper" for 3.2 doesn't affect *any* code in the 3.2 code line.
Comment 9 Frank Schönheit 2010-01-04 14:45:17 UTC
In IRC, mechtilde reported she still cannot connect to "localhost", using the
1.0.1 alpha version pointed to above, in OOo 3.2 RC 1. However, the error
message now doesn't talk about a socket error anymore, but mentions the "111"
number which seems to be some kind of generic error ...

I still cannot reproduce the problem at all, I just tried with a freshly
installed OOo 3.2 RC1, the 1.0.1 alpha, any a freshly installed MySQL server 5.1.36.

I'll leave this issue open for a while - perhaps somebody has new ideas how to
reproduce the problem. If not, then I'll close it as WORKSFORME. Sorry, but I
cannot fix what I cannot reproduce.
Comment 10 john.mccreesh 2010-01-04 17:01:08 UTC
I saw this problem on my Ubuntu 9.10 desktop as reported in

I can now repeat the problem on my new laptop using Ubuntu 9.10 64 bit, OOo 3.2
RC1, mysql-connector-ooo-1.0.0-linux-x86_64.oxt, MySQL server version:

Steps to reproduce:

From the database wizard:

1. Select database: Connect to an existing database - MySQL
2. Set up MySQL connection: Connect directly
3. Set up MySQL server data: Database name: stuff Server: localhost Port: 3306
4. Set up user authentication: User name: mystuff Password required: Check
press <test connection>
Password dialog box: enter password Remember password to end of session: check
Press <ok>
Error: "Cannot connect to local MySQL server through sockect '/tmp/mysql.sock' (2)"

Fails every time.
Comment 11 Frank Schönheit 2010-01-06 10:15:48 UTC
well, yes, that's exactly what I did here ... and it works fine :-\
Comment 12 rene 2010-01-07 08:21:28 UTC
> I still cannot reproduce the problem at all, I just tried with a freshly
> installed OOo 3.2 RC1, the 1.0.1 alpha, any a freshly installed MySQL server
> 5.1.36.

And probably with the MySQL on the same host and in the same system so that the
socket can be used..

Try using OOo from a chroot with "localhost". Or try disabling socket auth (or
just rm the socket)

> I'll leave this issue open for a while - perhaps somebody has new ideas how to
> reproduce the problem.

it is trivial to reproduce this problem with chroots and mysql running on the
"real" host
Comment 13 Frank Schönheit 2010-01-08 12:37:16 UTC
> Try using OOo from a chroot with "localhost". Or try disabling socket auth
> (or just rm the socket)

Removing the socket doesn't change anything, OOo still works like a charm -
indicating that it indeed connects via TCP. Tried with the 1.0.0 release of the
connector, on unxlngi6.
Comment 14 Frank Schönheit 2010-01-28 08:34:33 UTC
Phhh ... Just browsing through some BugZilla administration page (completely
unrelated to this issue here), I stumbled over the following:

  This setting is required because MySQL ignores the port specified by the
  client and connects using its compiled-in socket path (on unix machines) when
  connecting from a client to a local server.

, which reminded me of this issue here ...
Comment 15 Frank Schönheit 2010-02-19 10:47:40 UTC
As I still cannot reproduce the problem, I move the issue to the
"dbaneedsconfirm" pool, and reset the target.
Comment 16 timrichardson 2010-02-19 11:41:13 UTC
Well, it now works for me in the Debian 3.2 packages. Thanks.
Comment 17 r4zoli 2012-09-09 06:07:48 UTC
According to reporter the bug was fixed.
Comment 18 r4zoli 2012-09-09 06:08:20 UTC
fixed-> closed.