Current location: Hot Scripts Forums » Programming Languages » PHP » Remote Access to SQL DB?


Remote Access to SQL DB?

Reply
  #1 (permalink)  
Old 08-30-07, 07:58 PM
phpdoctor's Avatar
phpdoctor phpdoctor is offline
Code Guru
 
Join Date: Feb 2007
Location: New Zealand
Posts: 767
Thanks: 4
Thanked 2 Times in 2 Posts
Question Remote Access to SQL DB?

Hay,
I know this is possible by something like this:
PHP Code:

mysql_connect('http://www.mysite.com''user''pass') ; 

And use this in sql for permissions:
Quote:
GRANT ALL PRIVILEGES ON [database].* TO [user]@"%" IDENTIFIED BY '[password]';
But is there a way to do it securely...?
I know its not efficient this way but I have no choice.

Anyway can someone help me out with this stuff?
Thanks,
Lex
__________________
01010000 01001000 01010000
Reply With Quote
  #2 (permalink)  
Old 08-31-07, 12:23 AM
jexxie jexxie is offline
Newbie Coder
 
Join Date: Aug 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Yup, you can do this:
http://ca3.php.net/mysql_connect

You can only use an IP address to specify the remote MySQL server.

Also, it's best to limit which IPs can login to a database remotely, you can do this like so:
GRANT ALL PRIVILEGES ON *.* TO USERNAME@IP IDENTIFIED BY "PASSWORD";

Hope that helps.
Reply With Quote
  #3 (permalink)  
Old 08-31-07, 02:19 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Note that most servers don't allow that. Try to contact your host and ask them for more info.
Reply With Quote
  #4 (permalink)  
Old 08-31-07, 03:36 AM
jexxie jexxie is offline
Newbie Coder
 
Join Date: Aug 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
If you can connect connect to the remote MySQL server, like this, it should work fine.

If you're using Windows, Start->Run-> cmd.exe
Type:
telnet IPADDRESSOFYOURHOST 3306

IF that pops up with a connected message, you're good to go.
Reply With Quote
  #5 (permalink)  
Old 08-31-07, 05:10 PM
phpdoctor's Avatar
phpdoctor phpdoctor is offline
Code Guru
 
Join Date: Feb 2007
Location: New Zealand
Posts: 767
Thanks: 4
Thanked 2 Times in 2 Posts
Thanks guys il contact my host for some info.
But is it secure?

Also by limiting IP address access, what ip do you mean?
Thanks alot,
Lex
__________________
01010000 01001000 01010000
Reply With Quote
  #6 (permalink)  
Old 09-01-07, 10:12 AM
fyrestrtr fyrestrtr is offline
Wannabe Coder
 
Join Date: Nov 2003
Posts: 191
Thanks: 0
Thanked 0 Times in 0 Posts
You cannot do mysql_connect('http://server.com') it must be mysql_connect('server.com') or mysql_connect('some.ip.address')
__________________
Find me at WHT
Reply With Quote
  #7 (permalink)  
Old 09-02-07, 06:24 PM
phpdoctor's Avatar
phpdoctor phpdoctor is offline
Code Guru
 
Join Date: Feb 2007
Location: New Zealand
Posts: 767
Thanks: 4
Thanked 2 Times in 2 Posts
ok thanks, but is it secure?
What if I used a SSL or something?
The information needs to be secure

Lex
__________________
01010000 01001000 01010000
Reply With Quote
  #8 (permalink)  
Old 09-03-07, 01:37 PM
jexxie jexxie is offline
Newbie Coder
 
Join Date: Aug 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Hi there,

The information would be transmitted plan-text, so the information wouldn't be safe from prying eyes. If you're wanting to have it safe, I would suggest getting a local MySQL server.
Reply With Quote
  #9 (permalink)  
Old 09-03-07, 02:43 PM
phpdoctor's Avatar
phpdoctor phpdoctor is offline
Code Guru
 
Join Date: Feb 2007
Location: New Zealand
Posts: 767
Thanks: 4
Thanked 2 Times in 2 Posts
Ye I got a local mySQL server and i need to connect to a remote also.
I dont much choice with the remote sql servers.

Thanks anyway
__________________
01010000 01001000 01010000
Reply With Quote
  #10 (permalink)  
Old 09-03-07, 04:32 PM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
The mysql manual contains a section on connecting and transferring data through an SSL connection - http://dev.mysql.com/doc/refman/5.0/...using-ssl.html
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL db - custom insert and select query app needed ATS16805 ASP.NET 1 06-24-05 04:38 PM
Problem with inserting values into an access db pinochio53 ASP 1 03-29-05 12:53 PM
Access to SQL Script conversion PaniXOH PHP 1 11-16-03 06:30 AM
Script Conversion: Access Database/Now to SQL PaniXOH ASP 1 11-14-03 09:35 PM
change my field in this example sal21 ASP 3 07-14-03 02:49 AM


All times are GMT -5. The time now is 06:09 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.