Jump to content

Run PHP Script On Home Machine, Access MySQL of Site

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
rsnider19

rsnider19

    Learning Programmer

  • Members
  • PipPipPip
  • 34 posts
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
Guest_Jordan_*

Guest_Jordan_*
  • Guests
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
rsnider19

rsnider19

    Learning Programmer

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

#4
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Nope. If you have problems doing it, feel free to come back here for help. :)

#5
rsnider19

rsnider19

    Learning Programmer

  • Members
  • PipPipPip
  • 34 posts
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
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
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)
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall