Upgrade failing on missing db phabricator_application


#1

I am running into the following issue when using the upgrade script. It’s failing on the storage upgrade command. The previous upgrade was over a while back.

Error:
Applying patch “phabricator:db.application” to host “localhost:3306”…
[2018-07-09 12:06:35] EXCEPTION: (AphrontAccessDeniedQueryException) #1044: Access denied for user ‘phab’@‘127.0.0.1’ to database ‘phabricator_application’ at [/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:319]
arcanist(head=master, ref.master=222800a86ed0), phabricator(head=master, ref.master=4214b56a4f4f), phutil(head=master, ref.master=4206849bb05b)
#0 AphrontBaseMySQLDatabaseConnection::throwCommonException(integer, string) called at [/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:348]
#1 AphrontBaseMySQLDatabaseConnection::throwQueryCodeException(integer, string) called at [/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:289]
#2 AphrontBaseMySQLDatabaseConnection::throwQueryException(mysqli) called at [/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:185]
#3 AphrontBaseMySQLDatabaseConnection::executeRawQuery(string) called at [/src/xsprintf/queryfx.php:8]
#4 queryfx(AphrontMySQLiDatabaseConnection, string, string, string) called at [/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php:168]
#5 PhabricatorStorageManagementAPI::createDatabase(string) called at [/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php:235]
#6 PhabricatorStorageManagementAPI::applyPatch(PhabricatorStoragePatch) called at [/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementWorkflow.php:1103]
#7 PhabricatorStorageManagementWorkflow::doUpgradeSchemata(array, NULL, boolean, boolean) called at [/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementWorkflow.php:849]
#8 PhabricatorStorageManagementWorkflow::upgradeSchemata(array, NULL, boolean, boolean) called at [/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementUpgradeWorkflow.php:78]
#9 PhabricatorStorageManagementUpgradeWorkflow::didExecute(PhutilArgumentParser) called at [/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementWorkflow.php:107]
#10 PhabricatorStorageManagementWorkflow::execute(PhutilArgumentParser) called at [/src/parser/argument/PhutilArgumentParser.php:441]
#11 PhutilArgumentParser::parseWorkflowsFull(array) called at [/src/parser/argument/PhutilArgumentParser.php:333]
#12 PhutilArgumentParser::parseWorkflows(array) called at [/scripts/sql/manage_storage.php:249]

The database in question does not exist. Below is the list of phabricator databases.
MariaDB [(none)]> show databases;
±-------------------------+
| Database |
±-------------------------+
| information_schema |
| mysql |
| performance_schema |
| phabricator_almanac |
| phabricator_audit |
| phabricator_auth |
| phabricator_badges |
| phabricator_cache |
| phabricator_calendar |
| phabricator_chatlog |
| phabricator_conduit |
| phabricator_config |
| phabricator_conpherence |
| phabricator_countdown |
| phabricator_daemon |
| phabricator_dashboard |
| phabricator_differential |
| phabricator_diviner |
| phabricator_doorkeeper |
| phabricator_draft |
| phabricator_drydock |
| phabricator_fact |
| phabricator_feed |
| phabricator_file |
| phabricator_flag |
| phabricator_fund |
| phabricator_harbormaster |
| phabricator_herald |
| phabricator_legalpad |
| phabricator_maniphest |
| phabricator_meta_data |
| phabricator_metamta |
| phabricator_multimeter |
| phabricator_nuance |
| phabricator_oauth_server |
| phabricator_owners |
| phabricator_packages |
| phabricator_passphrase |
| phabricator_pastebin |
| phabricator_phame |
| phabricator_phlux |
| phabricator_pholio |
| phabricator_phortune |
| phabricator_phragment |
| phabricator_phrequent |
| phabricator_phriction |
| phabricator_phurl |
| phabricator_policy |
| phabricator_ponder |
| phabricator_project |
| phabricator_releeph |
| phabricator_repository |
| phabricator_search |
| phabricator_slowvote |
| phabricator_spaces |
| phabricator_system |
| phabricator_token |
| phabricator_user |
| phabricator_worker |
| phabricator_xhpast |
| phabricator_xhprof |
| redmine |
±-------------------------+
62 rows in set (0.24 sec)


#2

the “phabricator:db.application” patch is trying to create the database. Make sure your account (phab) has permission to create databases.


#3

I gave the user create privileges, then it complained it didn’t have alter for another database or table while it has grant all on all phabricator databases. I had to grant . to the user to get it to upgrade. Where are the permissions required detailed in the documentation? I can’t find this information.


#4

They might not be explicitly documented.
The user needs to be able to create and alter databases and tables, select and update tables, etc.


#5

This can be marked as closed, but users should know the required permissions so they can secure their installations as much as possible.