Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

“Can't connect … through socket '/tmp/mysql.sock'” using C API mysql_real_connect() (no replies)

$
0
0
Hi All


I'm running OS 11.1 Big Sur and updating an objective C program that uses the MySql C API (NOT the C Connector). I CAN connect to local MySql server from the command line using

/usr/local/mysql/bin/mysql --user=root --password=aPassword

but when my software tries to connect through the C API using mysql_real_connect(mSQLPtr, theHost, theLogin, thePass, theDatabase, 0, NULL, 0); it fails with:

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

I've read heaps of posts to try and fix it e.g. stopping and starting the server, checking that /tmp/mysql.sock file does exist after starting the server (AND IT DOES EXIST), and adding a my.cnf to the /etc folder. It contains:

[mysqld]
socket=/tmp/mysql.sock

[client]
socket=/tmp/mysql.sock

I've also done chmod 777 /tmp/mysql.sock

Nothing has worked so far. Can anyone offer any suggestions please.

Cheers Jeff

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>