Upgrading stable causes Access Denied Query Exception during storage upgrade


#1

Observed Behavior:
During the storage upgrade after updating to today’s stable, I get an AphrontAccessDeniedQueryException using the database user/pass I’ve been operating under for a year or so (ie, this isn’t a credentials problem). Full stack trace below.

Loading the web site displays “Run the storage upgrade script to upgrade databases (host “db.isaracorp.com” is out of date). Missing patches: phabricator:20170918.ref.01.position.php.”

Expected Behavior:
Upgrade should succeed, or provide enough information for me to fix the issue(s).

Phabricator Version:
stable branch with git hash of 7a81553879816ff0c63433fe86fb9a393e38477a; server isn’t currently operating due to this issue.

Reproduction Steps:
Run bin/storage upgrade.

Stack Trace:

Before running storage upgrades, you should take down the Phabricator web
interface and stop any running Phabricator daemons (you can disable this
warning with --force).

    Are you ready to continue? [y/N] y

Applying patch "phabricator:20170918.ref.01.position.php" to host "db.isaracorp.com"...
[2017-09-29 13:23:19] EXCEPTION: (AphrontAccessDeniedQueryException) #1044: Access denied for user 'phabricator'@'code.isaracorp.com' to database 'phabricator_repository' at [<phutil>/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:319]
arcanist(head=stable, ref.master=9e82ef979e81, ref.stable=e88a8c077b33), phabricator(head=stable, ref.stable=7a8155387981), phutil(head=stable, ref.master=0107c187b6d8, ref.stable=5764bd8cafb8)
  #0 AphrontBaseMySQLDatabaseConnection::throwCommonException(integer, string) called at [<phutil>/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:348]
  #1 AphrontBaseMySQLDatabaseConnection::throwQueryCodeException(integer, string) called at [<phutil>/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:289]
  #2 AphrontBaseMySQLDatabaseConnection::throwQueryException(mysqli) called at [<phutil>/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:185]
  #3 AphrontBaseMySQLDatabaseConnection::executeRawQuery(string) called at [<phutil>/src/xsprintf/queryfx.php:8]
  #4 queryfx(AphrontMySQLiDatabaseConnection, string, string) called at [<phabricator>/resources/sql/autopatches/20170918.ref.01.position.php:26]
  #5 require_once(string) called at [<phabricator>/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php:285]
  #6 PhabricatorStorageManagementAPI::applyPatchPHP(string) called at [<phabricator>/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php:241]
  #7 PhabricatorStorageManagementAPI::applyPatch(PhabricatorStoragePatch) called at [<phabricator>/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementWorkflow.php:1103]
  #8 PhabricatorStorageManagementWorkflow::doUpgradeSchemata(array, NULL, boolean, boolean) called at [<phabricator>/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementWorkflow.php:849]
  #9 PhabricatorStorageManagementWorkflow::upgradeSchemata(array, NULL, boolean, boolean) called at [<phabricator>/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementUpgradeWorkflow.php:78]
  #10 PhabricatorStorageManagementUpgradeWorkflow::didExecute(PhutilArgumentParser) called at [<phabricator>/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementWorkflow.php:107]
  #11 PhabricatorStorageManagementWorkflow::execute(PhutilArgumentParser) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:441]
  #12 PhutilArgumentParser::parseWorkflowsFull(array) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:333]
  #13 PhutilArgumentParser::parseWorkflows(array) called at [<phabricator>/scripts/sql/manage_storage.php:249]```

#2

I ran into the same issue. The problem is that the upgrade script wants to lock a table, which the phabricator user did not have access to. Once the user had proper rights (lock table), everything went fine.


#3

From the error message:

#1044: Access denied for user ‘phabricator’@‘code.isaracorp.com’ to database ‘phabricator_repository’

Is this not clear enough?


#4

That error message doesn’t say what operation failed; some indication that it was “LOCK TABLES” failing would’ve made this much easier to resolve.