Problem with database port numbers, causing site cloning to fail

Issue Summary

For certain WordPress plugins I have to add the non-standard database port number, used by Local, to the DB_HOST constant in wp-config.php. This causes subsequent site cloning to fail.

Troubleshooting Questions

  • Does this happen for all sites in Local, or just one in particular?
    Any site.

  • Are you able to create a new, plain WordPress site in Local and access it in a Browser?


There are WordPress plugins that access the database in a way that requires to explicitly specify the port number. They get the port number from the data provided in the wp-config.php: if DB_HOST includes a port number, then that is what it uses and otherwise the default 3306.

In principle this is all right. According to the documentation, WordPress expects that the port number is added to the DB_HOST constant if the database is not accessed using the default port.

The Local software does not use 3306 but different port numbers. This is unavoidable because it uses a different port for each site you create on Local. However, Local does not require you to specify this different port number in the wp-config.php file. I suppose this is for better compatibility with live hosts on Flywheel and WP Engine (where the port numbers will be different - probably everywhere the default 3306).

However, I found that specifying a port number for DB_HOST in wp-config.php creates a problem when cloning a site; it just does not work. I guess this is because the clone and the original both have localhost with the same port number specified in their wp-config.php files; the cloning process does not change that.

Is there anybody having a suggestion how to handle this – other than by removing the port number before cloning (or exporting - same problem on import) and putting it in again, afterwards?

System Details

  • Which version of Local is being used? 5.10.3+5332

  • What Operating System (OS) and OS version is being used? Windows 10 Pro, 10.0.19042

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.