admin管理员组

文章数量:1430479

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','');
define('WP_SITEURL','');
define('LIVE_SITEURL', '');

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/mysqldf

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' );

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');

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' );
Share Improve this question edited May 3, 2019 at 20:01 Best Dev Tutorials asked May 3, 2019 at 19:16 Best Dev TutorialsBest Dev Tutorials 4451 gold badge7 silver badges21 bronze badges 7
  • 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 Commented May 3, 2019 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 Commented May 3, 2019 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. – norman.lol Commented May 3, 2019 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 Commented May 3, 2019 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. – norman.lol Commented May 3, 2019 at 22:30
 |  Show 2 more comments

1 Answer 1

Reset to default 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.

本文标签: local installationWorking on live sites locally