Hi!
> I am writing multi-thread C codes to connect to MySQL, but something =
> strange happened:
> I have to put the mysql_real_connect in a while loop, and exit only if =
> it succeed.
> This is because sometimes I will get the error: Can't connect to local =
> MySQL server through socket '/tmp/mysql.sock' (146), and I have to retry =
> several times.
>
> Can anybody tell me how to solve it? It is a little "expensive" to do a =
> while loop......
>
> I am running mysql-3.22.23b on Solaris 7x86, and the client library is =
> compiled with thread option.
> The mysql is started with max_connections =3D 200, and the client =
> program has only 50 threads.
>
> Thanks in advance.
(~) perror 146
Connection refused
Try increasing the mysqld 'back_log' variable. If this doesn't help you have
to check your man pages for the reason of 'connection refused' to a
connect/bind call.
Regards,
Monty