Package: libmariadb-dev
Version: 1:3.0.6-1
Severity: important

Dear Maintainer,

While writing a program to access a MariaDB database, I ran into an
issue when trying to connect to the server. When the program tries to
connect, it returns the following error message:

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Some searching revealed that the running instance of mysql has a
socket at /var/run/mysqld/mysql.sock. The program could not find that
socket, however, since by default the shared library tries to connect
at '/tmp/mysql.sock'.

There are two possible workarounds for this:

1) Create a symlink (/tmp/mysql.sock -> /var/run/mysqld/mysql.sock)

2) Use mysql_optionsv(mysql, MYSQL_READ_DEFAULT_GROUP, "client") to
read the configuration from the client section of the files at
/etc/mysql (specifically, /etc/mysql/mariadb.conf.d/50-client.cnf)

I am not sure if this is the way this is supposed to work, and whoever
tries to write code to access the server should be using
mysql_optionsv, but I think the library should use
/var/run/mysqld/mysql.sock as the default value for the socket, since
this _is_ the default location for the server package.

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'stable-updates'), (500, 'unstable'), 
(500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.18.0-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.utf8), LANGUAGE=en_US.utf8 (charmap=UTF-8) (ignored: LC_ALL set to 
en_US.utf8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libmariadb-dev depends on:
ii  libc6        2.27-6
ii  libmariadb3  1:3.0.6-1

libmariadb-dev recommends no packages.

libmariadb-dev suggests no packages.

-- no debconf information

Reply via email to