Answers.Body: <p>Try using a port variable:</p>
  
  <pre><code>'STAGING' =&gt; array(
      'server' =&gt; 'localhost',
      'port' =&gt; '3939',
      'user' =&gt; 'myusername',
      'password' =&gt; '***********',
      'database' =&gt; 'mydatabase',
  ),
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-05T18:39:37.027Z
Answers.Text: I've tried adding the variable to my config file without any luck. Do I need to add this variable anywhere else? I've been able to successfully connect to the database (and add content) with a MySQL database manager like Sequel Pro so I know the database is functioning.
Answers.UserDisplayName: RhealPoirier
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-05T19:27:38.400Z
Answers.Text: Perhaps try placing it in the default '*' block and see if it works to rule out the possibility that your 'staging' condition is not working properly. Assuming the database is on the same server as the config file, I would also try using `'server' => 'localhost',`
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-05T21:29:51.713Z
Answers.Text: Using `'server' => 'localhost',` and `'port' => '3939',` worked for my situation.
Answers.UserDisplayName: RhealPoirier
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-05T21:31:33.903Z
Answers.Text: Great! I updated the answer.
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-05T17:28:09.907Z
Answers.LastActivityDate: 2015-01-05T21:31:42.097Z
Answers.LastEditDate: 2015-01-05T21:31:42.097Z
Answers.UserDisplayName: Douglas McDonald
Body: <p>I'm in the process of creating a multi-environment config and my client has set up a staging server with non-standard ports for the mysql server. I am unsure how to add the port number in the config file. I've tried the following with no success.</p>
  
  <pre><code>'STAGING' =&gt; array(
          'server' =&gt; '123.456.789.123:3939',
          'user' =&gt; 'myusername',
          'password' =&gt; '***********',
          'database' =&gt; 'mydatabase',
      ),
  </code></pre>
  
  <p>I've been able to successfully connect the database when on a completely different server/mysql combo so I know that the config files work. </p>
  
Tags: <config><database>
Title: Multi-Environment Config using port in database server
ThreadText: # Multi-Environment Config using port in database server
  
  (Asked by: username_0 on 2015-01-05)
  
  I'm in the process of creating a multi-environment config and my client has set up a staging server with non-standard ports for the mysql server. I am unsure how to add the port number in the config file. I've tried the following with no success.
  
  ```
  'STAGING' => array(
          'server' => '123.456.789.123:3939',
          'user' => 'myusername',
          'password' => '***********',
          'database' => 'mydatabase',
      ),
  
  ```
  
  I've been able to successfully connect the database when on a completely different server/mysql combo so I know that the config files work.
  
  **Tags:** config, database
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-01-05. Score: 4 | Accepted answer
  
  Try using a port variable:
  
  ```
  'STAGING' => array(
      'server' => 'localhost',
      'port' => '3939',
      'user' => 'myusername',
      'password' => '***********',
      'database' => 'mydatabase',
  ),
  
  ```
  
  > **Comments:**
  > **username_0**: I've tried adding the variable to my config file without any luck. Do I need to add this variable anywhere else? I've been able to successfully connect to the database (and add content) with a MySQL database manager like Sequel Pro so I know the database is functioning.  
  > **username_1**: Perhaps try placing it in the default '*' block and see if it works to rule out the possibility that your 'staging' condition is not working properly. Assuming the database is on the same server as the config file, I would also try using `'server' => 'localhost',`  
  > **username_0**: Using `'server' => 'localhost',` and `'port' => '3939',` worked for my situation.  
  > **username_1**: Great! I updated the answer.  
  
  ---
  
  