0

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

Carel
  • 131
  • 7
  • 1
    The is no need to change the DB port when you change the HTTP port. The MySQL Port stays the same. – Gerald Schneider Nov 28 '16 at 10:54
  • Change you `DB_HOST` setting back to `localhost` without any ports and look at your error logs. – Gerald Schneider Nov 28 '16 at 10:56
  • Hey, thanks. Where do I find the error logs? If I simply attempt to access wp-admin I get the error message `Could not find site www.mydomain.co.za:8080. Searched for table rs_blogs in database marc. Is that right?` – Carel Nov 28 '16 at 10:59
  • You have to change "site-url" in the tables wp_options if you decide to do this that way. Otherwhise you should not have to make that change in wordpress at all. The initial problem you had with the browser was just the browsers cache. – Orphans Nov 28 '16 at 11:03
  • WordPress has [detailed instructions for moving a site](https://codex.wordpress.org/Moving_WordPress) (yes, changing the port is "moving"). – Gerald Schneider Nov 28 '16 at 11:14

0 Answers0