LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-20-2009, 05:18 PM   #1
gibbsj
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Rep: Reputation: 0
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
 
Old 04-20-2009, 07:01 PM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
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.
 
Old 04-20-2009, 08:14 PM   #3
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
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
 
Old 04-23-2009, 06:22 AM   #4
jisjis
LQ Newbie
 
Registered: Apr 2009
Posts: 18

Rep: Reputation: 0
Quote:
Originally Posted by gibbsj View Post
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

Last edited by jisjis; 04-26-2009 at 04:41 AM.
 
Old 04-23-2009, 11:07 PM   #5
gibbsj
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Original Poster
Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't connect remotely to MySQL... gain Linux - Networking 20 01-29-2007 04:01 PM
Using MySQL database remotely ACDII Linux - Software 1 10-27-2006 11:10 AM
How to remotely connect handheld to Mysql glenn69 Linux - Laptop and Netbook 1 09-24-2006 10:12 AM
cannot connect to mysql database PAD_LOCK Programming 5 09-01-2006 02:03 PM
Can't connect to MySQL server remotely on RedHat 9 bper Red Hat 4 10-02-2003 10:56 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration