4

Please excuse my ignorance, as I'm entirely self taught (HTML, CSS, and some JS and PHP) as a hobby, and SSH is all fairly new to me.

I originally built a static website for my wife's childminding business using HTML and CSS. Then after a while, made it into a PHP template.

It would be good if she could update it herself, so I'd like to create a WordPress template.

I've currently got a local WordPress install (using XAMPP), which is working fine, and the template is coming along nicely.

I've also created a droplet on DigitalOcean with a WordPress install, which is working fine, and she's started editing the content for the site on here.

I'm editing the template files and CSS locally, and pushing it via SFTP.


I'm looking to connect my local WordPress site to the DigitalOcean database remotely, so that I can edit the content.

I've connected to the db using MySQL WorkBench, so I know it's possible to connect remotely.

I have tried copying the wp-config file from DO to my local machine, but when I do this, I get the error Error establishing a database connection.

I think the issue is with the DB_HOST which is currently set to localhost. When I change it to my DO IP address 46.xxx.xx.68, and change the DB_USER = root and DB_PASSWORD = ***********.

When I initially tried connecting to the DB via Workbench, I set the SSH Hostname and the MYSQL hostname to my 46.xxx.xx.68 IP address, which didn't work, and instead had to set the MYSQL Hostname to 127.0.0.1.

I've done some reading online, and as I understand it, I'll need to SSH into the server, and forward my connection to 127.0.0.1.

I tried using this tutorial here, which is now slightly dated.

But was unsure what to replace [email protected] with.

I also saw this post question: Connect to remote database using Localhost install but there wasn't actually an answer of "you can't do it"

Any help or guidance would be appreciated.

5
  • 1
    You can do it only if the remote server allows remote connections, but it is a horribly bad idea. An error on your development server could destroy the live data.
    – s_ha_dum
    Commented Dec 17, 2015 at 21:15
  • The remote server allows remote connections, as I've connected to it with Workbench, as stated in the OP. This wouldn't be used once the site is in production, it currently sits behind am htacess file. Only purely for dev purposes.
    – n8udd
    Commented Dec 17, 2015 at 22:48
  • Followup question: Why do you need to connect to the remote server at all? Are you and wife working from different locations? Honestly, the question is starting to sound off-topic being really just server configuration with nothing to do with WordPress.
    – s_ha_dum
    Commented Dec 17, 2015 at 23:21
  • I use 2 machines, one at work, and one at home. Also, my wife has her own laptop, and is using the WordPress app on her phone to upload content to posts.
    – n8udd
    Commented Dec 18, 2015 at 15:06
  • Alright, well, you are going to have to sort out the connection issue with the remote host. As I suspected, this isn't really WordPress. Sorry.
    – s_ha_dum
    Commented Dec 18, 2015 at 15:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.