PDA

View Full Version : Compiling with MySQL


stan
02-27-1999, 09:24 PM
Hi,

How should I compile a C program with MySQL calls?

gcc -I/usr/local/mysql/include/ -lmysql myprog.c

The -I is needed to get to <mysql.h>

The library is not placed right I thinks:

%file /usr/lib/mysql
/usr/lib/mysql: broken symbolic link to /usr/local/mysql/lib/mysql

Or should I include a -L option?

Stan

------------------
Stan P. van de Burgt stan@dmo.com (PGP 0x853296C5)
DMO, P.O. box 1248, 3500 BE, Utrecht, the Netherlands


[This message has been edited by stan (edited 02-27-99).]

Terra
02-27-1999, 11:57 PM
Hello Stan,

Hmmmm, Thanks for the heads up... The symlink must have gotten broken during the last MySQL upgrades...

I have deleted the '/usr/lib/mysql' as it should now be '/usr/local/lib/mysql'...

Give that a shot, and if needed use the -L/usr/local/mysql/lib or -L/usr/local/lib/mysql

--
Terra
--Likes to read in the *library*--
FutureQuest

stan
02-28-1999, 08:17 AM
I now compiled it with

% gcc -I/usr/local/mysql/include/ -L/usr/local/mysql/lib myprogram.c -lmysqlclient

No complains now, except from the compiled program itself (below) but I'll sort that out
MySQL: Host '205.244.185.204' is not allowed to connect to this MySQL server


Thanks

Stan

Terra
02-28-1999, 03:25 PM
You will need to use any of the 2 below:

1) xdmo@localhost
2) xdmo@127.0.0.1 (I believe this one works for locals)

You are trying to make a TCP connection, when you should be trying to make a local PIPE socket connection...

--Terra

[This message has been edited by ccTech (edited 02-28-99).]

stan
02-28-1999, 10:52 PM
Yes.

That was the problem indeed.
And I checked the documentation again and I should indeed compile with -lmysqlclient

Thanks a lot!

Stan