I've recently changed a WordPress site that is hosted on a local server from port 80
to port 8080
. I did this initially just by editing the binding in IIS.
The site kept redirecting itself back to port 80
. After some Googling, I found the following line in the wp-config.php
file:
define('DOMAIN_CURRENT_SITE', 'www.mydomain.com');
I changed this to:
define('DOMAIN_CURRENT_SITE', 'www.mydomain.com:8080');
With this, it no longer redirected to port 80
, but I got the error:
Error establishing a database connection
Looking further into the wp-config.php
file, I tried changing
define('DB_HOST', 'localhost');
to
define('DB_HOST', 'localhost:8080');
but still get the same database connection error.
I've tried
define('DB_HOST', '127.0.0.1:8080');
define('DB_HOST', '192.10.115.552:8080'); // Take this as the servers static ip address
define('DB_HOST', 'www.mydomain.com:8080');
All of these give the same error message. I also found a setting for debugging which I turned to true
With that, I get the following messages:
Warning: mysqli_real_connect(): MySQL server has gone away in C:\inetpub\wwwroot\mysite\wp-includes\wp-db.php on line 1529
Warning: mysqli_real_connect(): Error while reading greeting packet. PID=7700 in C:\inetpub\wwwroot\mysite\wp-includes\wp-db.php on line 1529
Warning: mysqli_real_connect(): (HY000/2006): MySQL server has gone away in C:\inetpub\wwwroot\mysite\wp-includes\wp-db.php on line 1529