Connecting to MYSQL database on remote server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
agadgil
Forum Newbie
Posts: 7
Joined: Thu Aug 28, 2003 6:02 am

Connecting to MYSQL database on remote server

Post by agadgil »

I want to connect to a mysql database remotely.
For instance,
I am connecting to mysql database server at 192.138.1.102 from my server say, 'myservername'
mysql_connect("192.138.1.102", user, pwd)
When I exceute this through my php page I cannot connect to the server.
It gives an error suggesting 'user@myservername' has no access to the database.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Have you got the permissions to access the database via an IP other than localhost? You need to make sure that your username has these permissions otherwise you will be denied access.

Is this your own database server or is it on a hosted machine?

Mac
agadgil
Forum Newbie
Posts: 7
Joined: Thu Aug 28, 2003 6:02 am

Post by agadgil »

What kind of permissions will I require?
I can access the database that is on 192.128.1.102 from the same machine with the help of user and password that I am passing to the function mysql_connect.
agadgil
Forum Newbie
Posts: 7
Joined: Thu Aug 28, 2003 6:02 am

Post by agadgil »

Do I require to have "user@myservername" as a user registered at 192.138.1.102?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Is this your own database server or is it on a hosted machine?

Mac
Post Reply