Title: Alternate database port
Last modified: August 22, 2016

---

# Alternate database port

 *  [zipnar](https://wordpress.org/support/users/zipnar/)
 * (@zipnar)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/alternate-database-port/)
 * Hi Cory,
 * Long time fan, first time commenter.
 * I’ve been trying to use Duplicator to transfer a site to Media Temple Managed
   WP hosting. Connecting to the database was failing, and their support suggested
   it is because they use port 3312.
 * When I navigate to `/installer.php` and enter a port option in the database hostname(
   e.g. `path.to.db.host:3312`), I get a connection error.
 * Browsing through the installer.php file, it looks like you are checking for an
   alternate db port on lines 157/158. But the only way I can get it to connect 
   to the db is to:
 * 1.) Hardcode the new port number on line 157/158 of the installer.php file
    2.)
   Omit the port option in the hostname when entering connection details on the 
   front end.
 * After that, it connects without issue.
 * Any other suggestions for dealing with alternate port numbers?
 * [https://wordpress.org/plugins/duplicator/](https://wordpress.org/plugins/duplicator/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Cory Lamle](https://wordpress.org/support/users/corylamleorg/)
 * (@corylamleorg)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/alternate-database-port/#post-5855336)
 * Hey Zipnar,
 * That is a bit odd. I haven’t been able to reproduce that. Are you entering in“
   [http://myhost:3312&#8221](http://myhost:3312&#8221); or just myhost:3312?
 * Thanks~
 *  Thread Starter [zipnar](https://wordpress.org/support/users/zipnar/)
 * (@zipnar)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/alternate-database-port/#post-5855360)
 * I have tried both ways, with and without the “[http://&#8221](http://&#8221);
   prefix. Both ways failed to connect.
 *  [Cory Lamle](https://wordpress.org/support/users/corylamleorg/)
 * (@corylamleorg)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/alternate-database-port/#post-5855406)
 * Yeah I’m not 100% sure; the code for the port extraction is just two lines, I’m
   not sure why it is not parsing the url for you correctly.
 *     ```
       $_POST['dbport']	= isset($_POST['dbhost'])	  ? parse_url($_POST['dbhost'], PHP_URL_PORT) : 3306;
       $_POST['dbport']    = (! empty($_POST['dbport'])) ? $_POST['dbport'] : 3306;
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Alternate database port’ is closed to new replies.

 * ![](https://ps.w.org/duplicator/assets/icon-256x256.png?rev=2906985)
 * [Duplicator - Backups & Migration Plugin - Cloud Backups, Scheduled Backups, & More](https://wordpress.org/plugins/duplicator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/duplicator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/duplicator/)
 * [Active Topics](https://wordpress.org/support/plugin/duplicator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/duplicator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/duplicator/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Cory Lamle](https://wordpress.org/support/users/corylamleorg/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/alternate-database-port/#post-5855406)
 * Status: not resolved