Thanks for the answer Monty. Here's what happened.
When I rebuilt with --enable-thread-safe-client I got a SEGV on
behavior 1 (as well as 2, 3, 4), making things worse!
However, when I changed my code to use your suggested
MYSQL *mysql = mysql_init((MYSQL *) 0);
ALL the behaviors worked.
So I am happy, everything seems fine. I don't understand why the
original code didn't work, but then again I don't care too much :-)
BTW I upgraded to redhat 5.2 in the middle there somewhere, which also
didn't help fix the problem. At least things were no different in the
output of my program once I had managed to upgrade.
Thanks again, and to Ed Carp and Aldrian Gintingsuka for their
responses.
Regards,
Terry