We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Error in Upgrade from 2.11.3 to 3.4.3: Could not connect to database

News and General

nwbt1's avatar
nwbt1
2 posts
8 years ago
nwbt1's avatar nwbt1

Hello,

I’m getting an error very similar to this thread, however, I have doublechecked all of my database settings and they are accurate.

I am running MySQL Server version 5.5.18 and PHP 5.6.22, and I’m trying to upgrade an EE install from 2.11.3 to 3.4.3.

I’m following the steps outlined here: https://docs.expressionengine.com/latest/installation/upgrade_from_2.x.html

I’m at Step 5: Run Upgrade, and I’m getting the error message:

Oops, there was an error Unable to connect to your database using the configuration settings found in the following file: config/config.php file. Please correct the settings so that the update can proceed.

I have uploaded the database.php and config.php from the 2.11.3 install into the new system/user/config/ folder, and so these are the exact same database settings which are in use with the working install of 2.11.3.

I downloaded the EE Server Wizard and ran it. It throws the following error

Fatal error: Uncaught exception ‘PDOException’ with message ‘SQLSTATE[HY000] [2005] Unknown MySQL server host ‘redacted.edu:64284’ (2)’ in /nfs/bronfs/redacted/ee_wizard/index.php:250 Stack trace: #0 /nfs/bronfs/redacted/ee_wizard/index.php(250): PDO->__construct(‘mysql:host=redacted…’, ‘redacted_db_user’, ”) #1 /nfs/bronfs/redacted/ee_wizard/index.php(130): check_db(Array) #2 {main} thrown in /nfs/bronfs/redacted/ee_wizard/index.php on line 250

Thanks in advance for any assistance!

       
nwbt1's avatar
nwbt1
2 posts
8 years ago
nwbt1's avatar nwbt1

I solved this issue. It was related to my custom port number for the MySQL server.

To solve this, I made three edits in config/database.php:

  • Updated the database driver to ‘mysqli’ (it was “mysql”, which is now depreciated)
  • Added $db[‘expressionengine’][‘port’] = ‘my custom port number’;
  • Edited $db[‘expressionengine’][‘hostname’] to remove the port number (it used to be ‘server.domain.com:port’

The previous settings worked with the old mysql driver, but mysqli and pdo requires the port number to be in a separate parameter.

The above port setting doesn’t seem to be documented anywhere that I could find.

       
dwg-andy's avatar
dwg-andy
27 posts
8 years ago
dwg-andy's avatar dwg-andy

glad you figured it out, and thanks for posting your solution. Who knows when someone else may run across this.

       
Tom Spetter's avatar
Tom Spetter
25 posts
8 years ago
Tom Spetter's avatar Tom Spetter

Thank you nwbt1!

Thank you for posting your own solution. It helped a lot and saved my upgrade.

I owe you a beer.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.