admin管理员组

文章数量:1295275

Okay so I have a wordpress website that I've been developing locally on my netbook. I want to be able to develop it both on my netbook and on my desktop so in order to ease the process and not have to reconfigure stuff each time I switch between the two, I decided to host my database remotely on my website, and then just configure the code for the local install to refer to the same database etc.

I've followed this guide:

and it does not seem to be working for me. I have gone on my host's control panel (Dreamhost) and put my local IP as an allowable host, and I've set my wp-config files to map to my domain. And yet it still will not go through.

Any clues on what I'm doing wrong?

The only step in that link I didn't follow was: --Replace each instance of 'localhost' with your 'Server Name' in MAMP. (localhost is default)

Because I don't actually know what that means exactly? I don't know what it means to replace localhost with Server Name in MAMP...

Okay so I have a wordpress website that I've been developing locally on my netbook. I want to be able to develop it both on my netbook and on my desktop so in order to ease the process and not have to reconfigure stuff each time I switch between the two, I decided to host my database remotely on my website, and then just configure the code for the local install to refer to the same database etc.

I've followed this guide:

https://coderwall/p/ck8v4a/remote-database-with-local-wordpress-instance

and it does not seem to be working for me. I have gone on my host's control panel (Dreamhost) and put my local IP as an allowable host, and I've set my wp-config files to map to my domain. And yet it still will not go through.

Any clues on what I'm doing wrong?

The only step in that link I didn't follow was: --Replace each instance of 'localhost' with your 'Server Name' in MAMP. (localhost is default)

Because I don't actually know what that means exactly? I don't know what it means to replace localhost with Server Name in MAMP...

Share Improve this question asked Sep 21, 2017 at 22:44 Aslan FrenchAslan French 2354 silver badges18 bronze badges 5
  • First, test if your server is allowing remote connections first telnet DH_IP 3306 (via terminal), if it just hangs there then contact DreamHost about it. – Ismail Commented Sep 21, 2017 at 23:01
  • note that doing this will be sloooow, you'd be much better off copying the data to a local setup. Doing a request to another server is one of the slowest things you can do, and now your site will do this for every query it makes. 1 request can take a second, and a page can easily have 20-30 queries, that's a 30 second page load – Tom J Nowell Commented Sep 21, 2017 at 23:14
  • @TomJNowell it will be slow? If it's just pulling down data from the database how slow can it be? The database is very small, less than 64mb total, and all the other files will be local etc. – Aslan French Commented Sep 22, 2017 at 21:52
  • each time it does a query it has to go to the remote server, then the query runs, then the data has to be sent back. Even if the query took 1 nanosecond, and returned the smallest possible value, you've still got the back and forth time. Ping the remote server and you'll have a minimum time. This isn't a problem normally because databases are co-located with webhosts over high speed interlinks, or on the same machine, so it's a single hop away, or on the same CPU. This will be significantly slower than a local database – Tom J Nowell Commented Sep 23, 2017 at 3:30
  • Okay cool, thanks well I found a better solution! This thing called InstantWP allows me to run a local server off a USB drive. It's also WP only so it is less complicated and a bit easier to use than MAMP. instantwp – Aslan French Commented Sep 23, 2017 at 4:34
Add a comment  | 

1 Answer 1

Reset to default 1

What you are trying to do will not work as you local PCs will most likely get different IP addresses from time to time which will mean that you will have to reconfigure your server.

Your solution is much simpler.... just host the development site on your server, use the hosts file of your PCs to map whatever domain name you use for development to the IP of the server. You will also need some server side configuration to support that domain name, but since you use relatively respectable company, I assume it is something that you can do without having actual control of the domain, or use a subdomain of your site

本文标签: localhostHow do I access a remote database with a local MAMP development install