+ Reply to Thread
Results 1 to 6 of 6

Thread: Run PHP Script On Home Machine, Access MySQL of Site

  1. #1
    Learning Programmer rsnider19 is an unknown quantity at this point
    Join Date
    Sep 2009
    Posts
    30

    Run PHP Script On Home Machine, Access MySQL of Site

    I don't know exactly how to search for this but I want to run a PHP script on my home PC which access the MySQL database on my website. I know to connect to the "localhost" database (which if the script was on my website would be the correct one), but how can I connect to a database on say www (dot) example (dot) com?

  2. #2
    Administrator Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan's Avatar
    Join Date
    Nov 2005
    Location
    Hendersonville, NC
    Posts
    24,751
    Blog Entries
    97

    Re: Run PHP Script On Home Machine, Access MySQL of Site

    Instead of localhost, you'll simply put "www.example.com". You'll need to make sure the MySQL port is open on the server firewall and your local firewall (if they exist). Then you'll need to have access granted to your account from your local Internet IP or set access to be allowed from anywhere for your account in MySQL.

  3. #3
    Learning Programmer rsnider19 is an unknown quantity at this point
    Join Date
    Sep 2009
    Posts
    30

    Re: Run PHP Script On Home Machine, Access MySQL of Site

    Ok. I thought it would be something like that. Wasn't sure if it would need to end in /localhost or not. Thanks.

  4. #4
    Administrator Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan's Avatar
    Join Date
    Nov 2005
    Location
    Hendersonville, NC
    Posts
    24,751
    Blog Entries
    97

    Re: Run PHP Script On Home Machine, Access MySQL of Site

    Nope. If you have problems doing it, feel free to come back here for help.

  5. #5
    Learning Programmer rsnider19 is an unknown quantity at this point
    Join Date
    Sep 2009
    Posts
    30

    Re: Run PHP Script On Home Machine, Access MySQL of Site

    Ok, so I did all that, at least to my knowledge, and I still got:

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'doineedt_wordpre'@'cpe-xx-xxx-xx-xxx.columbus.res.rr.com' (using password: YES) in.

    Under cpanel access host I added my ip from ipchicken. Is that the one I want? I allowed the port 3306 on my firewall on my pc, but my server doesn't have one.

  6. #6
    Moderator Orjan is a glorious beacon of light Orjan is a glorious beacon of light Orjan is a glorious beacon of light Orjan is a glorious beacon of light Orjan is a glorious beacon of light Orjan's Avatar
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Age
    35
    Posts
    2,688
    Blog Entries
    7

    Re: Run PHP Script On Home Machine, Access MySQL of Site

    in my cpanel, I have a part named "MySQL Remote" where I register the IP-addresses that may access the server, in the database section (not visible in all skins either)
    __________________________________________
    Ask me: Orjan | Contribute to the Wiki! | Make your own Programming blog!
    I usually play eRepublik and Travian when I'm not on CodeCall

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Tutorial: Storing Images in MySQL with PHP
    By Jordan in forum PHP Tutorials
    Replies: 45
    Last Post: 07-02-2010, 01:24 AM
  2. Using FULLTEXT Searches with PHP and MySQL
    By phillw in forum PHP Tutorials
    Replies: 9
    Last Post: 04-19-2010, 10:35 AM
  3. Server Security
    By kresh7 in forum Security Tutorials
    Replies: 1
    Last Post: 04-10-2010, 07:40 PM
  4. Engine for site on Java Script without PHP, SQL
    By antihero in forum JavaScript and CSS
    Replies: 9
    Last Post: 09-08-2008, 01:21 PM
  5. Replies: 3
    Last Post: 07-09-2008, 03:06 AM