473,414 Members | 1,947 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

mysql accessed remotely

I want to know how you can access a remote mySQL database from a php script.

Also how can I connect to a remote mysql database from mysql administrator?
Jul 17 '05 #1
8 2239
Kenneth wrote:
I want to know how you can access a remote mySQL database from a php
script.
mysql_connect($ipaddress, $username, $password);

where $ipaddress is the IP address of the server you want to connect to.
Note that you may not be able to connect to a remote mysql database if
a) the firewall blocks the mysql port b) mysql is not configured to
listen to a port or c) your login doesn't have privileges to connect
remotely.
Also how can I connect to a remote mysql database from mysql
administrator?


Find the configuration dialog and set the hostname to an IP address. See
above notes about why you still may not be able to connect.

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Jul 17 '05 #2
Here is the message i get when i use

mysql_connect($ipaddress, $username, $password);
error:

Warning: mysql_connect(): Unknown MySQL Server Host 'db195.perfora.net'
(1) in /oldhome/WWW/wingsofthedawn.org/htdocs/final/Connections/myDB.php
on line 9

Fatal error: Unknown MySQL Server Host 'db195.perfora.net' (1) in
/oldhome/WWW/wingsofthedawn.org/htdocs/final/Connections/myDB.php on line 9


Chris Hope wrote:
Kenneth wrote:

I want to know how you can access a remote mySQL database from a php
script.

mysql_connect($ipaddress, $username, $password);

where $ipaddress is the IP address of the server you want to connect to.
Note that you may not be able to connect to a remote mysql database if
a) the firewall blocks the mysql port b) mysql is not configured to
listen to a port or c) your login doesn't have privileges to connect
remotely.

Also how can I connect to a remote mysql database from mysql
administrator?

Find the configuration dialog and set the hostname to an IP address. See
above notes about why you still may not be able to connect.

Jul 17 '05 #3
>mysql_connect($ipaddress, $username, $password);


error:

Warning: mysql_connect(): Unknown MySQL Server Host 'db195.perfora.net'
(1) in /oldhome/WWW/wingsofthedawn.org/htdocs/final/Connections/myDB.php
on line 9

Fatal error: Unknown MySQL Server Host 'db195.perfora.net' (1) in
/oldhome/WWW/wingsofthedawn.org/htdocs/final/Connections/myDB.php on line 9


db195.perfora.net is not a valid hostname. Fix your hostname
or fix your DNS.

Gordon L. Burditt
Jul 17 '05 #4
Gordon, why is not a valid hostname. and also how do i get the ip for
db195.perfora.net?
Gordon Burditt wrote:
mysql_connect($ipaddress, $username, $password);
error:

Warning: mysql_connect(): Unknown MySQL Server Host 'db195.perfora.net'
(1) in /oldhome/WWW/wingsofthedawn.org/htdocs/final/Connections/myDB.php
on line 9

Fatal error: Unknown MySQL Server Host 'db195.perfora.net' (1) in
/oldhome/WWW/wingsofthedawn.org/htdocs/final/Connections/myDB.php on line 9

db195.perfora.net is not a valid hostname. Fix your hostname
or fix your DNS.

Gordon L. Burditt

Jul 17 '05 #5
Kenneth wrote:
Gordon, why is not a valid hostname. and also how do i get the ip
for db195.perfora.net?


You run "nslookup db195.perfora.net" to get the IP address. This tells
you that there is no such hostname which is why Gordon would have said
it's not valid.

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Jul 17 '05 #6
So what is the next step?
Chris Hope wrote:
Kenneth wrote:

Gordon, why is not a valid hostname. and also how do i get the ip
for db195.perfora.net?

You run "nslookup db195.perfora.net" to get the IP address. This tells
you that there is no such hostname which is why Gordon would have said
it's not valid.

Jul 17 '05 #7
Kenneth wrote:
Gordon, why is not a valid hostname. and also how do i get the ip
for db195.perfora.net?


You run "nslookup db195.perfora.net" to get the IP address. This
tells you that there is no such hostname which is why Gordon would
have said it's not valid.


So what is the next step?


Use a valid hostname. Or find out the actual IP address of the server
you are trying to connect to. It's better to use the IP address anyway
to prevent any extra latency required in looking it up each time your
script wants to connect to the server.

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Jul 17 '05 #8
Chris you were right it was behind a firewall. So now I am running
script inside the server.

Thanks.
Chris Hope wrote:
Kenneth wrote:

Gordon, why is not a valid hostname. and also how do i get the ip
for db195.perfora.net?

You run "nslookup db195.perfora.net" to get the IP address. This
tells you that there is no such hostname which is why Gordon would
have said it's not valid.


So what is the next step?

Use a valid hostname. Or find out the actual IP address of the server
you are trying to connect to. It's better to use the IP address anyway
to prevent any extra latency required in looking it up each time your
script wants to connect to the server.

Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: filesiteguy | last post by:
Some partners of mine and I are writing a host-based application, which would greatly benefit if we could take advantage of a web services-like function we are formulating. Unfortunately, this...
4
by: Dave Moore | last post by:
Hi All, I'm looking at using PHP and MySQL for a particular website application. However, I was a bit concerned that if a PHP script went wrong then it would be possible to accidentally delete or...
0
by: Duane Winner | last post by:
Hello all - I'm having a small problem with the mysql startup script that ships with MySQL-3.23.56-1. I'm running on RedHat Linux. It works fine, but I have a backup server that runs a script...
3
by: pc | last post by:
hi everyone, I am trying to connect to a new mysql installation. I have given root permission to connect to all databases from anywhere; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY...
5
by: Ike | last post by:
Through Java, I am attempting to connect to a MySQL 4.12 server on a remote computer. I can connect fine via php. I cann connect fine via Java, through a servlet, when the servlet is on the same...
0
by: mdavila78 | last post by:
Hi there, I was wondering if it's possible to Clear MySQL's History Remotely. Considering that you only have root access to the database but no access to the linux box. I found something in...
12
by: mistral | last post by:
phpMyAdmin 2.6.2 problem: can no connects to mySQL database: each time shown error #1045 - Access denied for user 'username'@'192.168.1.2' (using password: YES) Is seems, this is most common...
4
by: martinf | last post by:
Hello group, I've inherited a box running FC6. The website I'm trying to copy across to it ran fine on FC5.. PHP & MySQL were set up 'out-the-box' so the site just worked. Somethings...
3
by: Sonasang | last post by:
Hi , I am develping a web page with MYSQL as backend.... I have installed MYSQL and MYSQL connector to access the datas remotely... But i am getting the error when i try to access the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.