dbTalk Databases Forums  

how to connect to online database from my home machine

comp.databases.mysql comp.databases.mysql


Discuss how to connect to online database from my home machine in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
richard
 
Posts: n/a

Default how to connect to online database from my home machine - 04-09-2011 , 12:39 AM






Specifically, what is the proper URL coding for this?
What exactly do I replace "localhost" with?
As there are three different ways to do this, with neither seeming to work.

1) example.com:3000 (for reference only)
2) www.example.com:3000
3) http://example.com:3000

What I am attempting to do is, create a script on my local machine, that
will create the table on the actual domain database.

Then, do I use the port and how do I find out exactly which port to use?
When I created the database on the server, I saw the port number of 3306.
Is that the port number of the table or the database(s) location?

Reply With Quote
  #2  
Old   
J.O. Aho
 
Posts: n/a

Default Re: how to connect to online database from my home machine - 04-09-2011 , 01:29 AM






richard wrote:
Quote:
Specifically, what is the proper URL coding for this?
What exactly do I replace "localhost" with?
As there are three different ways to do this, with neither seeming to work.

1) example.com:3000 (for reference only)
2) www.example.com:3000
3) http://example.com:3000
mysql -u<username> -p -h example.com -P 3000 <databasename>

the "-P 3000" is really only needed if the database server uses another port
than the default 3306.


Quote:
What I am attempting to do is, create a script on my local machine, that
will create the table on the actual domain database.
I suggest you look at PHP scripts, see www.php.net/mysqli
It's easy to add other things to the script too, but you can use mysqliadmin
too for just SQL related things.

Quote:
Then, do I use the port and how do I find out exactly which port to use?
When I created the database on the server, I saw the port number of 3306.
Is that the port number of the table or the database(s) location?
That's the port of the database service, same port number for all users and
regardless which database or table your use.

--

//Aho

Reply With Quote
  #3  
Old   
richard
 
Posts: n/a

Default Re: how to connect to online database from my home machine - 04-09-2011 , 01:46 AM



On Sat, 09 Apr 2011 08:29:16 +0200, J.O. Aho wrote:

Quote:
richard wrote:
Specifically, what is the proper URL coding for this?
What exactly do I replace "localhost" with?
As there are three different ways to do this, with neither seeming to work.

1) example.com:3000 (for reference only)
2) www.example.com:3000
3) http://example.com:3000

mysql -u<username> -p -h example.com -P 3000 <databasename

the "-P 3000" is really only needed if the database server uses another port
than the default 3306.


What I am attempting to do is, create a script on my local machine, that
will create the table on the actual domain database.

I suggest you look at PHP scripts, see www.php.net/mysqli
It's easy to add other things to the script too, but you can use mysqliadmin
too for just SQL related things.

Then, do I use the port and how do I find out exactly which port to use?
When I created the database on the server, I saw the port number of 3306.
Is that the port number of the table or the database(s) location?

That's the port of the database service, same port number for all users and
regardless which database or table your use.
Thanks for the info.
But I think you misunderstood. I do not want to establish a database on my
local machine.
I am using an editor on my machine and want to write a file that will send
the data I create locally to the hosted server through the script.

Regardless of which I use, my editor comes up with an error saying it can't
connect.

So what do I use instead of "localhost"?

Reply With Quote
  #4  
Old   
The Natural Philosopher
 
Posts: n/a

Default Re: how to connect to online database from my home machine - 04-09-2011 , 02:57 AM



richard wrote:
Quote:
On Sat, 09 Apr 2011 08:29:16 +0200, J.O. Aho wrote:

richard wrote:
Specifically, what is the proper URL coding for this?
What exactly do I replace "localhost" with?
As there are three different ways to do this, with neither seeming to work.

1) example.com:3000 (for reference only)
2) www.example.com:3000
3) http://example.com:3000
mysql -u<username> -p -h example.com -P 3000 <databasename

the "-P 3000" is really only needed if the database server uses another port
than the default 3306.


What I am attempting to do is, create a script on my local machine, that
will create the table on the actual domain database.
I suggest you look at PHP scripts, see www.php.net/mysqli
It's easy to add other things to the script too, but you can use mysqliadmin
too for just SQL related things.

Then, do I use the port and how do I find out exactly which port to use?
When I created the database on the server, I saw the port number of 3306.
Is that the port number of the table or the database(s) location?
That's the port of the database service, same port number for all users and
regardless which database or table your use.

Thanks for the info.
But I think you misunderstood. I do not want to establish a database on my
local machine.
I am using an editor on my machine and want to write a file that will send
the data I create locally to the hosted server through the script.

Regardless of which I use, my editor comes up with an error saying it can't
connect.

So what do I use instead of "localhost"?
it my be that your isp etc does no allow direct mysqld connections from
remote machines

Reply With Quote
  #5  
Old   
richard
 
Posts: n/a

Default Re: how to connect to online database from my home machine - 04-09-2011 , 04:03 AM



On Sat, 09 Apr 2011 08:57:13 +0100, The Natural Philosopher wrote:

Quote:
richard wrote:
On Sat, 09 Apr 2011 08:29:16 +0200, J.O. Aho wrote:

richard wrote:
Specifically, what is the proper URL coding for this?
What exactly do I replace "localhost" with?
As there are three different ways to do this, with neither seeming to work.

1) example.com:3000 (for reference only)
2) www.example.com:3000
3) http://example.com:3000
mysql -u<username> -p -h example.com -P 3000 <databasename

the "-P 3000" is really only needed if the database server uses another port
than the default 3306.


What I am attempting to do is, create a script on my local machine, that
will create the table on the actual domain database.
I suggest you look at PHP scripts, see www.php.net/mysqli
It's easy to add other things to the script too, but you can use mysqliadmin
too for just SQL related things.

Then, do I use the port and how do I find out exactly which port to use?
When I created the database on the server, I saw the port number of 3306.
Is that the port number of the table or the database(s) location?
That's the port of the database service, same port number for all users and
regardless which database or table your use.

Thanks for the info.
But I think you misunderstood. I do not want to establish a database on my
local machine.
I am using an editor on my machine and want to write a file that will send
the data I create locally to the hosted server through the script.

Regardless of which I use, my editor comes up with an error saying it can't
connect.

So what do I use instead of "localhost"?

it my be that your isp etc does no allow direct mysqld connections from
remote machines
could very well be. I had to get them to open up my email connection so I
could use my own domain mail. If I have to do it directly on the server
then, that's no big deal.

Reply With Quote
  #6  
Old   
J.O. Aho
 
Posts: n/a

Default Re: how to connect to online database from my home machine - 04-09-2011 , 06:20 AM



richard wrote:
Quote:
On Sat, 09 Apr 2011 08:29:16 +0200, J.O. Aho wrote:

richard wrote:
Specifically, what is the proper URL coding for this?
What exactly do I replace "localhost" with?
As there are three different ways to do this, with neither seeming to work.

1) example.com:3000 (for reference only)
2) www.example.com:3000
3) http://example.com:3000

mysql -u<username> -p -h example.com -P 3000 <databasename

the "-P 3000" is really only needed if the database server uses another port
than the default 3306.


What I am attempting to do is, create a script on my local machine, that
will create the table on the actual domain database.

I suggest you look at PHP scripts, see www.php.net/mysqli
It's easy to add other things to the script too, but you can use mysqliadmin
too for just SQL related things.

Then, do I use the port and how do I find out exactly which port to use?
When I created the database on the server, I saw the port number of 3306.
Is that the port number of the table or the database(s) location?

That's the port of the database service, same port number for all users and
regardless which database or table your use.

Thanks for the info.
But I think you misunderstood. I do not want to establish a database on my
local machine.
connect to remote server (using port 3000):
mysql -u<username> -p -h example.com -P 3000 <databasename>

connect to local server (using port 3000):
mysql -u<username> -p -P 3000 <databasename>

see the difference?
the mysql is the client tool, mysqld is the database server program.


Quote:
I am using an editor on my machine and want to write a file that will send
the data I create locally to the hosted server through the script.

Regardless of which I use, my editor comes up with an error saying it can't
connect.

So what do I use instead of "localhost"?
The remote servers domain name or it's ip-number.


--

//Aho

Reply With Quote
  #7  
Old   
Luuk
 
Posts: n/a

Default Re: how to connect to online database from my home machine - 04-09-2011 , 06:56 AM



On 09-04-2011 07:39, richard wrote:
Quote:
Specifically, what is the proper URL coding for this?
What exactly do I replace "localhost" with?
As there are three different ways to do this, with neither seeming to work.

1) example.com:3000 (for reference only)
2) www.example.com:3000
3) http://example.com:3000

What I am attempting to do is, create a script on my local machine, that
will create the table on the actual domain database.

Then, do I use the port and how do I find out exactly which port to use?
When I created the database on the server, I saw the port number of 3306.
Is that the port number of the table or the database(s) location?
You need to learn about firewalls...

Those things tend to STOP traffic at ports that are not allowed, like
port 3306.

So, generally, you are right, and you should be able to access your
remote database through remoteservername:3306, Where remoteservername
can be example.com, www.example.com, or whatever.example.com...

But in most, if not all, situations there is a firewall which makes this
impossible

--
Luuk

Reply With Quote
  #8  
Old   
The Natural Philosopher
 
Posts: n/a

Default Re: how to connect to online database from my home machine - 04-09-2011 , 09:11 AM



Luuk wrote:
Quote:
On 09-04-2011 07:39, richard wrote:
Specifically, what is the proper URL coding for this?
What exactly do I replace "localhost" with?
As there are three different ways to do this, with neither seeming to work.

1) example.com:3000 (for reference only)
2) www.example.com:3000
3) http://example.com:3000

What I am attempting to do is, create a script on my local machine, that
will create the table on the actual domain database.

Then, do I use the port and how do I find out exactly which port to use?
When I created the database on the server, I saw the port number of 3306.
Is that the port number of the table or the database(s) location?

You need to learn about firewalls...

Those things tend to STOP traffic at ports that are not allowed, like
port 3306.

So, generally, you are right, and you should be able to access your
remote database through remoteservername:3306, Where remoteservername
can be example.com, www.example.com, or whatever.example.com...

But in most, if not all, situations there is a firewall which makes this
impossible

even if its enabled at mysqld level. which it may not be.

I had to jump through several hoops to get this to work.

It does and really well, but not 'out of the box'.

Reply With Quote
  #9  
Old   
J.O. Aho
 
Posts: n/a

Default Re: how to connect to online database from my home machine - 04-09-2011 , 11:44 AM



The Natural Philosopher wrote:
Quote:
Luuk wrote:
On 09-04-2011 07:39, richard wrote:
Specifically, what is the proper URL coding for this?
What exactly do I replace "localhost" with?
As there are three different ways to do this, with neither seeming to
work.

1) example.com:3000 (for reference only)
2) www.example.com:3000
3) http://example.com:3000

What I am attempting to do is, create a script on my local machine, that
will create the table on the actual domain database.

Then, do I use the port and how do I find out exactly which port to use?
When I created the database on the server, I saw the port number of
3306.
Is that the port number of the table or the database(s) location?

You need to learn about firewalls...

Those things tend to STOP traffic at ports that are not allowed, like
port 3306.

So, generally, you are right, and you should be able to access your
remote database through remoteservername:3306, Where remoteservername
can be example.com, www.example.com, or whatever.example.com...

But in most, if not all, situations there is a firewall which makes this
impossible

even if its enabled at mysqld level. which it may not be.
In those cases you can always use ssh tunnels, if and only if you have ssh
access on the remote server (which people in most cases don't).



--

//Aho

Reply With Quote
  #10  
Old   
Gordon Burditt
 
Posts: n/a

Default Re: how to connect to online database from my home machine - 04-09-2011 , 06:21 PM



Quote:
Specifically, what is the proper URL coding for this?
What exactly do I replace "localhost" with?
If you have a hosted database, ask the people you pay money to.

*IF* the hosting company allows direct mysql access at all (many don't
except from the associated web site you get with the hosting, which
is on the hosting company's machine, maybe the same one as the mysql
database), you need:

- The host name or IP address of the server. Typically this
will reflect the name of the hosting company, like
server3824528.bighostingcompany.net .
- The port number of the server (typically 3306 but it may vary).
If it's 3306 you generally don't need to specify it.
If you don't know the port number, try 3306 first, or don't
specify it at all.
- A username to use to log in.
- A password to use to log in.
You may have more than one username/password combination, one for
administrative privileges over you database (create/delete tables),
one for web/PHP access which only allows read/write of tables, and
perhaps one for read-only access to tables. Or maybe you just
get one. When you signed up, you may have been able to choose these.
- A database name to use (typically, you get only *ONE* database)
on a shared server. If you can have more, you need the name of
one you've already created. You don't have to select a database
to create one, if you're allowed to create one with
"create database". You can switch databases after you get logged
in, assuming you have more than one.

Typical command-line access (usually to a machine on your own LAN)
is done by:

% mysql --host=$hostname --port=$port -user=$username --password=$password $databasename
(that all goes on one line, where $hostname, $port, etc. represent
the information you fill in. Don't actually type the $ unless you
are using shell variable substitution.)

If you are trying to use a GUI mysql client, you'll have to say
which one, and although the same pieces of data are needed, the
format may vary.

Note that direct mysql access over the Internet is generally
considered risky (the data is not normally encrypted unless you're
using SSL between clients and the database, which has to be set up
specially on both ends, so *DON'T* send credit card numbers) and
hosting companies often don't allow it, and firewalls often block
it. Those that do allow it may require you to register a block of
IP addresses from which access is allowed; this can be problematic
if you don't have a static IP address.

You may have to ssh into the web site that comes with the hosting,
and use the command-line client *from that host*. Since the MySQL
server and the web server may be on the same host, 'localhost' may
be correct, but only if you use it while ssh'd into the web server
that's part of your hosting contract (if there is one).

If you need direct mysql access from a hosting company, always ASK
first before spending money (also read the documentation they may
provide, which may eliminate them right away). Many don't offer
it at any price.


Quote:
As there are three different ways to do this, with neither seeming to work.

1) example.com:3000 (for reference only)
2) www.example.com:3000
3) http://example.com:3000
I've never seen mysql access referred to as 'http' before. The protocols
are very different.
Quote:
What I am attempting to do is, create a script on my local machine, that
will create the table on the actual domain database.
A script written in what? sh? PHP? TCL? BASIC? PERL?

Quote:
Then, do I use the port and how do I find out exactly which port to use?

When I created the database on the server, I saw the port number of 3306.
Is that the port number of the table or the database(s) location?
A MySQL server has a port number. Tables and databases do not,
except to the extent that tables and databases are on a MySQL server,
and a MySQL server has a port number. 3306 is the standard port
number for MySQL. Sometimes it is changed, for example, for running
more than one MySQL server on the same machine (unusual but possible,
and two MySQL servers on the same machine have to use different
ports) or to hide from viruses and hackers (not a particulary
effective tactic) or to get past firewalls. If you don't know the
port, try 3306 or (equivalently) don't specify it at all. This is
likely right better than 50% of the time.

How, exactly, did you create the database on the server? This is
the key to how to access it. Was there some kind of GUI on the
hosting company's web site when you signed up, or did you use a
command-line interface?

Reply With Quote
Reply




Thread Tools
Display Modes

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

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.