Learning C programming problem

Dominic Mitchell dom at happygiraffe.net
Tue Jan 30 08:19:59 GMT 2001


On Thu, Jan 25, 2001 at 03:19:12PM -0000, Simon Clayton wrote:
> Thanks for that - the next problem is then that if I try and remove the
> libraries (which I did anyway) when I try and connect to MySQL with
> 
> 	mysql_real_connect(&mysql, "localhost", "user", "password", "db", 0, "",
> 0);
> 
> The program compiles fine but then when I do
> 
> 	./test
> 
> I get
> 
> 	Can't connect to local MySQL server through socket '' (2)

To link in the MySQL code, you will need extra libraries.  Adding these
flags onto your command line (which I note you originally had :) will do
the trick:

	-L/usr/local/lib -lmysqlclient

-Dom




More information about the Ukfreebsd mailing list