I want to ask about connect database at website to my office database.
I have a website that hosted at a shared hosting server. I’m using PHP for the web and MySQL for database. Now, what I want is my website at the server connect to my MySQL database at my office database. Is there anyway to do that?
What I can do right now is my office app connect to database at web (remote MySQL) but what I need is the opposite, my web connect to my office database.
Sorry for my bad English.
MySQL is network database server and you can login from anywhere…
… if there is a network connection between computers 🙂
You just have to configure MySQL user permissions and allow login from that other machine (its IP-configurable, or you can allow any IP). By default MySQL user can login only from localhost. More information (you can use IP instead of domain)
You may have to ask your home/office internet provider (or network admin) to provide/configure “public IP”.
You may need to set up “virtual server” on your home/office router and configure any firewalls in home/office. MySQL uses 3306 port by default.
Added later: you may have to enable TCP/IP protocol in MySQL configuration. More…
One more thing – “localhost” means connecting computer to itself without network. If you are talking about 2 computers – better say “other computer” or “home computer”, not “localhost”.