mysql_real_connect only connects locally
I've written a program to access a mysql server (5.1.50). It connects when the host is localhost but won't connect if the host is anything else including 127.0.0.1 which I believe is the IP address equivalent. I can connect to the remote server using MySQLWorkbench. The error that I get is #2005 unknown mysql server host. My code in Objective-C on a mac is:
-(MYSQL *)startConnection: (const char *)msqhost
thePort:(const char *)msqport
msqOptions:(const char *)msqoptions
msqTTY: (const char *)msqtty
dbName:(const char *)dbName
userName: (const char *)login
usrPswd: (const char *)pwd{
MYSQL *theConnectResult;
int libRes = mysql_library_init(0, NULL, NULL);
theConnection = mysql_init(NULL);
if(!(theConnectResult = mysql_real_connect(theConnection, msqhost, login,pwd, dbName, msqport,NULL,0))){
[self checkError];
theConnection = theConnectResult;
}
return theConnection;
}
Subject
Views
Written By
Posted
mysql_real_connect only connects locally
5017
June 24, 2011 08:50AM
2127
June 24, 2011 11:39PM
1928
June 24, 2011 11:44PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.