diff --git a/resources/sql/autopatches/20210215.changeset.02.phid-populate.php b/resources/sql/autopatches/20210215.changeset.02.phid-populate.php --- a/resources/sql/autopatches/20210215.changeset.02.phid-populate.php +++ b/resources/sql/autopatches/20210215.changeset.02.phid-populate.php @@ -11,12 +11,20 @@ $temporary_table = 'tmp_20210215_changeset_id_map'; -queryfx( - $conn, - 'CREATE TEMPORARY TABLE %T ( - changeset_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, - changeset_phid VARBINARY(64) NOT NULL)', - $temporary_table); +try { + queryfx( + $conn, + 'CREATE TEMPORARY TABLE %T ( + changeset_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + changeset_phid VARBINARY(64) NOT NULL)', + $temporary_table); +} catch (AphrontAccessDeniedQueryException $ex) { + throw new PhutilProxyException( + pht( + 'Failed to "CREATE TEMPORARY TABLE". You may need to "GRANT" the '. + 'current MySQL user this permission.'), + $ex); +} $table_iterator = id(new LiskRawMigrationIterator($conn, $table_name)) ->setPageSize($chunk_size); diff --git a/src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php b/src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php --- a/src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php +++ b/src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php @@ -347,7 +347,16 @@ case 1142: // Access denied to table case 1143: // Access denied to column case 1227: // Access denied (e.g., no SUPER for SHOW SLAVE STATUS). - throw new AphrontAccessDeniedQueryException($message); + + // See T13622. Try to help users figure out that this is a GRANT + // problem. + + $more = pht( + 'This error usually indicates that you need to "GRANT" the '. + 'MySQL user additional permissions. See "GRANT" in the MySQL '. + 'manual for help.'); + + throw new AphrontAccessDeniedQueryException("{$message}\n\n{$more}"); case 1045: // Access denied (auth) throw new AphrontInvalidCredentialsQueryException($message); case 1146: // No such table