LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   trying to remotely connect to mysql database wont work (https://www.linuxquestions.org/questions/programming-9/trying-to-remotely-connect-to-mysql-database-wont-work-720518/)

gibbsj 04-20-2009 05:18 PM

trying to remotely connect to mysql database wont work
 
I am trying to connect to a remote mysql database. I am using mac os x serve. This is the code that I use, and it wont connect..

mysql_connect("serverip", "username", "password") or die(mysql_error());

I get the error

Access denied for user 'username'@'xserve.sun**********



The problem is, on the xserve, it's saying username @ xserve

it is not a user on xserve, its a user on our other database server... so it should be user@150.15.***.*** not xserve

Hko 04-20-2009 07:01 PM

Is the MySQL server actually listening on a TCP-port on a network interface to the outside world?

IIRC MySQL by default only listens at loopback interface (localhost, 127.0.0.1) or a filesystem socket.

graemef 04-20-2009 08:14 PM

you also need to ensure that the permissions are set up for the user to log in remotely, often it would be identified within the permissions systems as user@localhost

jisjis 04-23-2009 06:22 AM

Quote:

Originally Posted by gibbsj (Post 3515587)
I am trying to connect to a remote mysql database. I am using mac os x serve. This is the code that I use, and it wont connect..

mysql_connect("serverip", "username", "password") or die(mysql_error());

I get the error

Access denied for user 'username'@'xserve.sun**********



The problem is, on the xserve, it's saying username @ xserve

it is not a user on xserve, its a user on our other database server... so it should be user@150.15.***.*** not xserve



Is your login credentials right?

Also try tnsping xserve - does it resolve to the ip mentioned above?

Linux

gibbsj 04-23-2009 11:07 PM

I fixed it!! Thanks for all the reply's. I had to create a new user giving it permissions to connect to it's public ip.


All times are GMT -5. The time now is 03:44 PM.