Bug 152370 - MariaDB direct connection: Access through socket to separate instance of MariaDB impossible
Summary: MariaDB direct connection: Access through socket to separate instance of Mari...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.4.3.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Database-Connectivity
  Show dependency treegraph
 
Reported: 2022-12-04 16:46 UTC by Robert Großkopf
Modified: 2023-07-06 15:47 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Großkopf 2022-12-04 16:46:37 UTC
On Linux/KDE Akonadi creates a separate instance of MySQL. Runs in the users folder and could be connected to through Konsole with

mysql -S /run/user/1000/akonadi/mysql.socket

When trying to connect to this socket following error if Base appears:

Can't connect to MySQL server on 'localhost' (111) at /home/buildslave/source/libo-core/connectivity/source/drivers/mysqlc/mysqlc_general.cxx:120

Connection settings are only
Databasename → Test
Socket → /run/user/1000/akonadi/mysql.socket

… and nothing else, because there is no user needed …

For testing this you will need Linux and KDE. Akonadi will run by default with MariaDB started.
Start with the command in Konsole to see it is running.
SHOW DATABASES;
will show you the databases "test" and "akonadi".

Now try to connect by Base with direct connection - impossible.
Comment 1 Julien Nabet 2022-12-20 12:40:54 UTC
I gave a try with master sources updated today.
I know nothing about socket so just followed step1 and step2 from https://www.jetbrains.com/help/datagrip/how-to-connect-to-mysql-with-unix-sockets.html#step-4-configure-the-mysql-driver-in-ide

the only difference was for step2, there was a lacking "d", I had to use:
mysql -u root -p -S /var/run/mysqld/mysqld.sock

not:
mysql -u root -p -S /var/run/mysqld/mysql.sock

Then, I launched LO and used "/var/run/mysqld/mysqld.sock" for socket, used "root" for user and used the password associated, I tested the connection, it was ok.

So the difference with you is I had to use a user/password.
Comment 2 Robert Großkopf 2022-12-20 13:25:12 UTC
(In reply to Julien Nabet from comment #1)
> 
> Then, I launched LO and used "/var/run/mysqld/mysqld.sock" for socket, used
> "root" for user and used the password associated, I tested the connection,
> it was ok.

You are connecting to the socket of MySQL/MariaDB, which isn't a separate instance.
The only socket I found on my system is the instance through
Socket → /run/user/1000/akonadi/mysql.socket

Akonadi is running on every system with KDE.
You don't need to start MySQK/MariaDB-server for connecting to this socket and connecting (this way) to the separate Akonadi instance.

It is impossible to connect to the separate Akonadi instance through the systemwide MySQL/MariaDB-server. Akonadi uses it's own server…
Comment 3 Julien Nabet 2022-12-20 13:46:51 UTC
Ok since I don't use kde env (and so akonadi), I won't be able to test this.
Comment 4 László Károlyi 2023-06-17 15:46:37 UTC
Hey,

this is a long standing bug, I can confirm this for ages now. I get the same error when trying to connect to a local mariadb instance via a unix socket (non-tcp).

The same error shows:

"Can't connect to server on 'localhost' (111) at /usr/src/debug/libreoffice-fresh/libreoffice-7.5.3.2/connectivity/source/drivers/mysqlc/mysqlc_general.cxx:120"

It seems to me that using the unix socket is totally ignored, it always wants to connect via TCP, which my mariadb instance has disabled.
Comment 5 Adam664 2023-06-27 17:33:39 UTC
Can confirm the bug exists in some form using the versions listed below. I'm getting a different error, with different versions of LO, as listed below each version, listed below :-)

I can connect to the database directly using mysql on the console, with no password, as a regular user just as described in the original post.

Interestingly, with both versions, when the "Test Connection" button is clicked in the setup process, LO confirms the connection test as successful. After setting up the database connection, when LO gets to the Database home page, if the user clicks on an operation, like Queries, the connection error pops up.

Also tried each version with a username and password, and got the same errors. 

Version: 7.5.3.2 (X86_64)
Build ID: 50(Build:2)
CPU threads: 1; OS: Linux 6.3; UI render: default; VCL: kf5 (cairo+xcb)
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

--The connection to the data source "akonaditest2" could not be established.

--Access denied for user 'adam'@'localhost' (using password: NO) at /builddir/build/BUILD  /libreoffice-7.5.3.2/connectivity/source/drivers/mysqlc/mysqlc_general.cxx:12

Version: 7.7.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 5a2c6f4df7149f8c1f543f120fe19bd66abfc189
CPU threads: 1; OS: Linux 6.3; UI render: default; VCL: kf5 (cairo+xcb)
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

--The connection to the data source "akonaditest2" could not be established.

--Plugin sha256_password could not be loaded:  at /home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/connectivity/source/drivers/mysqlc/mysqlc_general.cxx:120