2

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.

4

Try using a port variable:

'STAGING' => array(
    'server' => 'localhost',
    'port' => '3939',
    'user' => 'myusername',
    'password' => '***********',
    'database' => 'mydatabase',
),
|improve this answer|||||
  • 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. – RhealPoirier Jan 5 '15 at 18:39
  • 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', – Douglas McDonald Jan 5 '15 at 19:27
  • Using 'server' => 'localhost', and 'port' => '3939', worked for my situation. – RhealPoirier Jan 5 '15 at 21:29
  • Great! I updated the answer. – Douglas McDonald Jan 5 '15 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.