Page 1 of 1

connecting to mysql by IP adress

Posted: Mon Apr 13, 2015 9:03 pm
by sms5138
Hi everyone,

I have set up all the functions for my application, and am looking to move my database to a server located in our office. i have been trying to figure out what i need to do to connect, and am having a bit of trouble. no matter how i insert the IP address the app will not connect to the database. I have included my current code below, and would appreciate any guidance that may be able to be provided. Should it make any difference the ip connects to phpmyadmin when used in a web browser. which i can connect to remotely using the same information but in a web broswer. I have tried the following variations for the database address:

put "https://192.168.0.2:123" into tDatabaseAddress
put "http://192.168.0.2:123" into tDatabaseAddress
put "192.168.0.2:123" into tDatabaseAddress
put "192.168.0.2" into tDatabaseAddress

Code: Select all

on openStack
   global gConnectionID

    put "https://192.168.0.2:123" into tDatabaseAddress
    put "DB1" into tDatabaseName
    put "****" into tDatabaseUser
    put "****" into tDatabasePassword
    
    put revOpenDatabase("MySQL", tDatabaseAddress, tDatabaseName, tDatabaseUser, tDatabasePassword) into tResult
    
    if tResult is a number then
       put tResult into gConnectionID
      
       answer info "succefully connected!!" & cr & "Connection ID = " & gConnectionID
    else
        put empty into gConnectionID
        answer error "Unable to connect." & cr & tResult
    end if
end openStack
Its quite posisble that I'm looking at this all wrong, but i'm unsure as to how i should proceed.

Thanks in advance!

-Sean

Re: connecting to mysql by IP adress

Posted: Mon Apr 13, 2015 10:55 pm
by ghettocottage
It is possible this is a setting on your server. Do you have phpmyadmin installed on your server? If not, you might consider it, as it can make things a little easier if you are't comfortable with doing things from command line.

If you do have phpmyadmin, you can log in, go to Users, and edit the Privileges for your user. Change the host from the default "localhost" to your LAN ip address of your client computer.
There is an option to keep the old settings as well, so keep that.

Save, and then try to connect. If that works, and you need to connect from multiple clients, you can change the host address to use some wild-cards like:

192.168.%.%

or whatever subnet you use.

Re: connecting to mysql by IP adress

Posted: Mon Apr 20, 2015 4:46 pm
by sms5138
Thanks for the help! After a bit of tinkering I was able to get it to connect.

Thanks again!

-Sean