0

I'm usually able to set this up very easily.

In my local wp-config.php file I just add the following lines:

define('WP_HOME','http://example.local');
define('WP_SITEURL','http://example.local');
define('LIVE_SITEURL', 'http://example.com');

Trying to set this up with a live Ubuntu server, I'm running into issues where I get a database error connection after a long wait time.

I have also edited the bind-address directive in my /etc/mysql/mysql.conf.d/mysqld.cnf

Is there anything else I should be looking out for with my local setup?

Thanks

Edit: also as require, I change the DB_HOST line to:

define( 'DB_HOST', 'remote.ip.here.yeah' );
  • Are you trying to connect to the live sites database? Where did the LIVE_SITEURL parameter come from? I can find no documentation on it. Usually local development happens with a local copy of the database – Tom J Nowell May 3 '19 at 19:28
  • @TomJNowell Yes trying to connect to a live DB. Maybe LIVE_SITEURL is deprecated -- it's what I've been using for the past year on my media temple servers. – Best Dev Tutorials May 3 '19 at 19:30
  • Don't do this! Why are you trying to do this? You want to manage content on your live site from your local machine? What happens when you locally create a post with an image then? Your live site will have the attachment added to the database but the image file will be missing on your live server. – leymannx May 3 '19 at 21:01
  • @leymannx I never create local posts like that. This is more so the marketing team can do things on the live site while I edit files. I've been doing it for years without issue. In fact I highly recommend others do it to streamline development within teams. – Best Dev Tutorials May 3 '19 at 22:23
  • No way. Code always goes upstream, database downstream. The rest is Git. Never manually touch any tracked file on the live server after the initial setup. – leymannx May 3 '19 at 22:30
2

It looks like you're connecting to the live database from your local machine. Not many hosts allow remote connections to the database by default. You may have to request this type of access from your host.

Also, it's highly recommended you work with a local copy of your database instead of connecting (and possibly changing) your live database.

By the way, I've never seen LIVE_SITEURL, either.

| improve this answer | |
  • I'm working on my own VPS though -- so hosting configuration shouldn't be an issue as I would have control over this. – Best Dev Tutorials May 3 '19 at 20:36
  • Are you sure the database user is able to be accessed remotely? – MikeNGarrett May 3 '19 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.