Details
-
Bug
-
Status: Closed (View Workflow)
-
Trivial
-
Resolution: Not a Bug
-
None
-
None
-
None
-
Archlinux, Slackware
Description
When I try to connect to mariadb server with program linked with libmariadbclient.a over local connection, then it reports:
mysql_real_connect:Can't connect to local MySQL server through socket '/tmp/mysql.sock'
My mysql setup in /etc/mysql/my.cnf uses:
socket = /run/mysqld/mysqld.sock
for [client] and [mysqld] section.
Howto setup connection in C program to use default socket path from
/etc/mysql/my.cnf ?
I found the solution:
I need to read config file with:
mysql_options(mysql, MYSQL_READ_DEFAULT_FILE, path);
Howto find what is the default setup path?
Do I need to manually chek if /etc/my.cnf or /etc/mysql/my.cnf or there is
better way to read my.cnf from default config directory?