UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

  • Index
  • » General
  • » mysql_real_connect only succeeds for root

#1 2008-09-23 02:46 PM

paratracker
Member
Registered: 2008-09-23
Posts: 4

Re: mysql_real_connect only succeeds for root

I'm having some trouble getting MySQL C API program to run except when the mysql user is root.  mysql_real_connect fails for other users (e.g. xyz).  xyz has select, insert, delete, & update privileges on the database it accesses.

mysqld is listed in hosts.allow (192.168.2.0/255.255.255.0) and hosts.deny (ALL).  Both mysql users can use the mysql command line client, so it's not a grant/privileges issue.

I'm guessing that something about the network setup or perhaps owner/group permissions could be involved.  Any suggestions would be greatly appreciated.

-Mike
PocketNumerix

Offline

#2 2008-09-30 04:12 AM

vic
Administrator
Registered: 2002-04-16
Posts: 90
Website

Re: mysql_real_connect only succeeds for root

As a rule the MySQL C API works, even from non-privileged accounts.  Try strace to see what is failing?

Offline

#3 2008-09-30 07:26 AM

paratracker
Member
Registered: 2008-09-23
Posts: 4

Re: mysql_real_connect only succeeds for root

Offline

#4 2008-09-30 10:15 AM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,239

Re: mysql_real_connect only succeeds for root

"Access denied for u" seems to be a reply from the server, I guess "u" is "user" but
truncated. Check the MySQL server logfile to see why access is denied, it probably
(hopefully) tells why.

Offline

#5 2008-09-30 04:05 PM

paratracker
Member
Registered: 2008-09-23
Posts: 4

Re: mysql_real_connect only succeeds for root

Offline

#6 2008-10-01 03:05 AM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,239

Re: mysql_real_connect only succeeds for root

Offline

#7 2008-10-01 04:42 AM

mlampkin
Administrator
From: Sol 3
Registered: 2002-06-12
Posts: 911
Website

Re: mysql_real_connect only succeeds for root

Just curious...

I am figuring your mysql server has root set as admin and defaults to a grant all situation for the local interface when any new db is created...  on the other hand - the users trying to log in might not have the proper grants ( other than localhost / 127.0.0.1 )...

Of course... you did write that the mysql client allows you connect with any user... but were you explicitly inserting the network address when using the client of leaving it blank / using 'localhost' /127.0.0.1 ? 

Anyway... point being - if the former... then I don't know... if the latter... check out the grant command / table for the db...


Michael


"The only difference between me and a madman is that I'm not mad."

Salvador Dali (1904-1989)

Offline

#8 2008-10-01 05:45 AM

paratracker
Member
Registered: 2008-09-23
Posts: 4

Re: mysql_real_connect only succeeds for root

Offline

#9 2009-04-02 09:00 AM

p1142301
Guest

Re: mysql_real_connect only succeeds for root

2009-2-28

  • Index
  • » General
  • » mysql_real_connect only succeeds for root

Board footer

Powered by FluxBB