I had a problem after duplicating a site for development purposes. I used a staging.domain.com sub domain for the copy of the site. I updated my config files and used a copy of my original database that had a different user name and password from the original site. The site worked OK and I was able to edit contant and install/upgrade extras. But when I tried to upgrade MODX from version 2.6.5 to 2.7.0, or re-run the 2.6.5 Setup the site would fail with a 503 error.
I have resolved the problem by changing the databse password but I am documenting it in case anyone else experiences it.
I believe the problem was with the password for the MySQL database. The line for the password (which has since been changed) read:
$database_password = 'g$p:V9W \"v2+';
The password was automatically generated by the hosting control pane and it worked fine for editing the MODX site via the manager and installing/upgrading extras.
When I ran UpgradeMODX 2.1.2-pl the updater reported that the connection to the database was successful and that all other requirments were in place. On clicking through to the update the site went into 503 a error.
The php error log reported:
(ERROR in xPDOConnection::connect @ /path/to/core/xpdo/xpdo.class.php : 3119) SQLSTATE[HY000] [1045] Access denied for user 'dbusername'@'localhost' (using password: YES)
Changing the password to one that did not contain any colons, backslashes, double quotes or spaces resolved the problem and allowed me to upgrade. I don’t know which of the characters in the password caused the problem as I have not had time to test, but I suspect either the space or the back slash.
@bobray I hope you don’t mind me tagging you in this as it may be something that interests you.
It is possible that you are all ‘face palming’ and asking who in their right mind would ever use a password containing those characters! If you are then this post is not for you but just for the idiots like me who didn’t know it would cause a problem.
This is what appears in the logs at the time of the upgrade.
[2020-05-04 15:16:57] (ERROR in xPDOConnection::connect @ /path/to/core/xpdo/xpdo.class.php : 3119) SQLSTATE[HY000] [1045] Access denied for user 'dbuser'@'localhost' (using password: YES)
[2020-05-04 15:16:57] (ERROR @ /path/to/core/xpdo/om/xpdoquery.class.php : 652) Could not construct or prepare query because it is invalid or could not connect: SELECT `modSystemSetting`.`key` AS `modSystemSetting_key`, `modSystemSetting`.`value` AS `modSystemSetting_value`, `modSystemSetting`.`xtype` AS `modSystemSetting_xtype`, `modSystemSetting`.`namespace` AS `modSystemSetting_namespace`, `modSystemSetting`.`area` AS `modSystemSetting_area`, `modSystemSetting`.`editedon` AS `modSystemSetting_editedon` FROM `modx_system_settings` AS `modSystemSetting`
[2020-05-04 15:16:57] (ERROR in xPDOConnection::connect @ /path/to/core/xpdo/xpdo.class.php : 3119) SQLSTATE[HY000] [1045] Access denied for user 'dbuser'@'localhost' (using password: YES)
[2020-05-04 15:16:57] (ERROR @ /path/to/core/xpdo/om/xpdoobject.class.php : 263) Error preparing statement for query: SELECT `modSystemSetting`.`key` AS `modSystemSetting_key`, `modSystemSetting`.`value` AS `modSystemSetting_value`, `modSystemSetting`.`xtype` AS `modSystemSetting_xtype`, `modSystemSetting`.`namespace` AS `modSystemSetting_namespace`, `modSystemSetting`.`area` AS `modSystemSetting_area`, `modSystemSetting`.`editedon` AS `modSystemSetting_editedon` FROM `modx_system_settings` AS `modSystemSetting` -
[2020-05-04 15:16:57] (ERROR in xPDOConnection::connect @ /path/to/core/xpdo/xpdo.class.php : 3119) SQLSTATE[HY000] [1045] Access denied for user 'dbuser'@'localhost' (using password: YES)
[2020-05-04 15:16:57] (ERROR @ /path/to/core/xpdo/om/xpdoquery.class.php : 652) Could not construct or prepare query because it is invalid or could not connect: SELECT `modSystemSetting`.`key` AS `modSystemSetting_key`, `modSystemSetting`.`value` AS `modSystemSetting_value`, `modSystemSetting`.`xtype` AS `modSystemSetting_xtype`, `modSystemSetting`.`namespace` AS `modSystemSetting_namespace`, `modSystemSetting`.`area` AS `modSystemSetting_area`, `modSystemSetting`.`editedon` AS `modSystemSetting_editedon` FROM `modx_system_settings` AS `modSystemSetting`
[2020-05-04 15:16:57] (ERROR in xPDOConnection::connect @ /path/to/core/xpdo/xpdo.class.php : 3119) SQLSTATE[HY000] [1045] Access denied for user 'dbuser'@'localhost' (using password: YES)
[2020-05-04 15:16:57] (ERROR @ /path/to/core/xpdo/om/xpdoobject.class.php : 263) Error preparing statement for query: SELECT `modSystemSetting`.`key` AS `modSystemSetting_key`, `modSystemSetting`.`value` AS `modSystemSetting_value`, `modSystemSetting`.`xtype` AS `modSystemSetting_xtype`, `modSystemSetting`.`namespace` AS `modSystemSetting_namespace`, `modSystemSetting`.`area` AS `modSystemSetting_area`, `modSystemSetting`.`editedon` AS `modSystemSetting_editedon` FROM `modx_system_settings` AS `modSystemSetting` -
[2020-05-04 15:16:57] (FATAL) Could not load core MODX configuration!
If there is nothing there that helps I can revert the site later and re-run the upgrade to see if I can re-run the upgrade and capture more logs.
Could it be the $ sign in the DB password, thats executed with double quotes somewhere/somehow? Or could the " sign cause this issue? I have seen the $ sign in DB passwords sometimes but not the quote sign.
I’m not sure. Although it is working OK now with a completely new password I intend to revisit this and see if I can narrow it down to a specific character.