SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Offline database connection

    I was wondering if can or should be able to connect to database from my local machine

    Example my constants file
    define("SERVER_NAME", "123.45.678.91");
    define("USERNAME", "grpwrk1");
    define("PASSWORD", "abc123");
    define("DATABASE_NAME", "grpdb1");

    This works fine from my http://www.mysite.com
    Database connections and database selection works along with retriving data.

    If i want to download the files and work on my comp with the same constants file work
    Will localhost/htdocs/mysite.com still be able to work

    So far i am getting this error
    Warning: mysql_connect() [function.mysql-connect]: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in D:\xampp\htdocs\tutorials\countrysideni.org\includes\db_connection.php on line 10
    Database connection failed: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

    Is it because what I am trying to do will never ever work or do i need to change some settings?

    Pierce

  2. #2
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    2 Thread(s)
    Hi Cyanide_Pierce,

    Your local computer is most likely protected by a firewall, it by default will not open port 3308 which you need to connect so you would need to NAT this open from within your firewall if it will allow you. However, this is not a good idea as it leaves your machine vulnerable. One option is to build a PFSense Firewall on a old tower you have, you then install open-vpn on it, create certificates and then open the vpn prior to connecting to your database. If you used open-vpn you would not need to open and NAT the mysql port.

    I do this all the time with my work and home servers and it works very reliably!

    Regards,
    Steve
    ictus==""

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the info but thats a little bit beyond my skills right now, plus it is for a group project in university. We planned to work on seperate pages with PHP and use the mysql database on the uni server, but we decided to work localy on our own xampp and upload the final database when were finished
    Thanks again

  4. #4
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    2 Thread(s)
    Yes you came up with a good solution that does not require near the same work to do Good job, and good luck with you project!

    You might want to look at GIT for sharing your scripts and keeping the scripts under version control. Version control can be tough when working with a group, so using something like GitHub might server you well.

    Regards,
    Steve
    ictus==""


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •