The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 23, 2019, 07:01:57 AM

Login with username, password and session length


Pages: [1] 2
  Print  
Author Topic: is it possible ... script here ... sql db there ?  (Read 4062 times)
NYDAz
Expert
****
Offline Offline

Posts: 212

The Night Stalker


View Profile
« on: November 05, 2009, 08:56:17 AM »

I'm wondering if it's possible to have a script on host 1 !

and a database on host 2 !

and to make them work together !

I'm trying but the script it's giving me an error about how he could not recognize the host 2 !

PS : If your wondering why I don't keep them together, it's because for host 1 i have only username/password for FTP !

 Grin
Logged

what's up?
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: November 05, 2009, 09:33:10 AM »

Absolutely, it's done all the time and, in fact, designed to be that way.

When you connect, you pass a host or IP, username, password and database name. If it's not being "recognized" at that point then perhaps server 1 is not resolving your hostname correctly. But if it's simply that it won't connect, then it's more likely a permissions problem. MySQL is really strong about permissions and just because a login (username) has full availability on the local host (127.0.0.1) doesn't mean it can do anything at all from another machine.

Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
NYDAz
Expert
****
Offline Offline

Posts: 212

The Night Stalker


View Profile
« Reply #2 on: November 05, 2009, 09:48:41 AM »

Absolutely, it's done all the time and, in fact, designed to be that way.

When you connect, you pass a host or IP, username, password and database name. If it's not being "recognized" at that point then perhaps server 1 is not resolving your hostname correctly. But if it's simply that it won't connect, then it's more likely a permissions problem. MySQL is really strong about permissions and just because a login (username) has full availability on the local host (127.0.0.1) doesn't mean it can do anything at all from another machine.



Exactly ... that's what I'm thinking too, perk !

For my example I illustrate the following :
- host 1 (script)
- host 2 (sql sb)
- when I try to connect host 1 to host 2 i use : username, password & host (host is something like nydaz.sqlawebhostingcompany.com)

It's obivioius it should work ... I'll take another look in the script !

But for the most hosts the host is something like localhost ! How can we know what the ip for that or something like that ?  Shocked
Logged

what's up?
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #3 on: November 05, 2009, 10:07:31 AM »

"localhost" literally means, "on this machine." It's usually a pseudo-DNS name for 127.0.0.1. You cannot use that to talk to another machine, in any case.

It's just a little more complicated than, "what is the address of this machine." If a machine has multiple addresses, then you may or may not have permissions on any one of them. Can you not call your ISP and simply ask? "What address should I use to address my database from the outside world?" Bear in mind that, as I said above, you may not even HAVE perms to talk to the DB from off that box ... so you'll probably wind up talking to your ISP in any case.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
NYDAz
Expert
****
Offline Offline

Posts: 212

The Night Stalker


View Profile
« Reply #4 on: November 05, 2009, 10:08:35 AM »

Thanks old man  Wink

 ROFLMAO
Logged

what's up?
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #5 on: November 05, 2009, 10:14:02 AM »

 Don't make me... What'd I do to deserve that? ? ?  ROFLMAO


BTW, get off my lawn you whippersnappers.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #6 on: November 05, 2009, 10:45:12 AM »

edit my.cnf

Find where it says [mysqld] and underneath you should see "bind address". make it your external IP. Not localhost or 127.0.0.x

run a query like

GRANT ALL PRIVILEGES ON *.* TO '[user]'@'[ip]' IDENTIFIED BY '[password]'

where [user] is the username you want to use, [ip] is the ip address of the server your script is running on (you can enable access from anywhere by using '%' instead, but if you do this you need to toss your computer out the window and never come near another computer again, as it's akin to clicking random links and opening random attachments in emails from strangers) and [password] is the password.

should be all set then. update your script to use the IP of your DB server as the host, and that username and password.

Wait til you get to try to setup 3-way replication  ROFLMAO
Logged

hai
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #7 on: November 05, 2009, 12:56:13 PM »

the big blockade is usually permission on the database side. MYsql, by default, does not allow external connections to anything.
Thats what V's stuff above
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #8 on: November 05, 2009, 01:05:57 PM »

... provided he has root enough access to GRANT ALL. if he doesn't have GRANT as a perm then he'll not be able to do anything.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
serialnoob
Journeyman
***
Offline Offline

Posts: 88


View Profile
« Reply #9 on: November 06, 2009, 08:49:20 PM »

Assuming shared hosts and cpanel, the mysql admin in cp can allow specific or range of IPs, access to mysql, provided "granting" as above.

However, it presumably provides a "possible access" to all the other users on this IP, relying only of the mysql password as security. Right?

The alternative I ended up using:  running a script on host 1 where the mysql resides, triggered from host 2 with access via .htaccess pass.

I have always wondered how the security issue compare in these 2 cases, anyone?







Logged

Success consists of going from failure to failure without loss of enthusiasm - Winston Churchill
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #10 on: November 09, 2009, 07:23:49 AM »

Neither one is secure, so it doesn't really matter. Depends on how paranoid you are. 90% of people don't need to worry about sending plain text over the wire.
Logged

hai
serialnoob
Journeyman
***
Offline Offline

Posts: 88


View Profile
« Reply #11 on: November 09, 2009, 06:32:42 PM »

Neither one is secure, so it doesn't really matter. Depends on how paranoid you are. 90% of people don't need to worry about sending plain text over the wire.
Very paranoid, considering it would probably take you a few seconds to get into these boxes! Although I doubt you would be impressed, or may be that is why you would not bother in the first place, just because it is plain text.

Then what are the not "plain text" someone would go after?
Logged

Success consists of going from failure to failure without loss of enthusiasm - Winston Churchill
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #12 on: November 10, 2009, 06:47:26 AM »

You could use SSL (HTTPS) or a VPN (usually SSH).

The chances of your particular mySQL creds getting sniffed are very low unless someone is specifically listening and knows where and when to listen. Like I said, depends on how paranoid you are. I'm not terribly worried about random strangers finding unencrypted packets I've sent, more worried about governments or other large organizations.
Logged

hai
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #13 on: November 10, 2009, 08:20:48 AM »

 Ditto

It's not your average creep that has the kind of time necessary to hunt you, it's a government with near limitless capability to sniff every packet going across a spine and recombine into a stream when they feel like it.

Contrary to popular myth, sniffing your personal traffic from somewhere other than physically at your ISP's or backyard is difficult enough to keep most boneheads from being able to do it.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
NYDAz
Expert
****
Offline Offline

Posts: 212

The Night Stalker


View Profile
« Reply #14 on: November 10, 2009, 08:40:03 AM »

all went good !

host 2 wouldn't let me to connect remote through my db !

Finded another host 2 with remote control ! Contact the support departament ! They've put my ip (host1) in their firewall (added exception) so I can connect remote !

Everything is running very smooth now !

 Smiley
Logged

what's up?
Pages: [1] 2
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!