Magento 2.0: Fixing a failed install

Seemingly due to some issues with my MySQL Server, Magento 2’s installer failed before it could complete. It left me with the following error in my browser:

Unable to proceed: the maintenance mode is enabled. 

Aha! I can turn maintenance mode off – that’s easy! Just watch as this error falls like that gummy bear tower you tried to build in junior school! Let’s hop over to Magento’s bin folder…

./magento maintenance:disable

Woohoo, and all is… erm.. yup. Still broken:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magentorc.store_website' doesn't exist, query was: SELECT `main_table`.* FROM `store_website` AS `main_table` WHERE (`is_default` = '1') AND (main_table.website_id > 0) ORDER BY main_table.sort_order ASC, main_table.name ASC

Hmm, a quick look at the magentorc table I'd previously created shows it's completely empty – looks like the MySQL issue was the dastardly culprit! After trying to get it to perform the setup again using a variety of cli commands (and a lot of swearing), I instead opted to remove the following file:

app/etc/env.php

This is where Magento keeps its database details. Removing this started the install process once more – voilà!