diff --git a/php/wp-settings-cli.php b/php/wp-settings-cli.php
index <HASH>..<HASH> 100644
--- a/php/wp-settings-cli.php
+++ b/php/wp-settings-cli.php
@@ -106,6 +106,11 @@ require( ABSPATH . WPINC . '/pomo/mo.php' );
 // Include the wpdb class and, if present, a db.php database drop-in.
 require_wp_db();
 
+// WP-CLI: Handle db error ourselves, instead of waiting for dead_db()
+global $wpdb;
+if ( !empty( $wpdb->error ) )
+	wp_die( $wpdb->error );
+
 // Set the database table prefix and the format specifiers for database table columns.
 // @codingStandardsIgnoreStart
 $GLOBALS['table_prefix'] = $table_prefix;
Restore our custom dead db check; `nonce_headers` isn't called until WP<I>

We'll need this check in place for compatibility purposes