Index: wp-includes/wp-db.php
===================================================================
--- wp-includes/wp-db.php	(revision 6423)
+++ wp-includes/wp-db.php	(working copy)
@@ -115,6 +115,7 @@
 <p>We were able to connect to the database server (which means your username and password is okay) but not able to select the <code>$db</code> database.</p>
 <ul>
 <li>Are you sure it exists?</li>
+<li>Does the user <code>".DB_USER."</code> have permission to use the <code>$db</code> database?</li>
 <li>On some systems the name of your database is prefixed with your username, so it would be like username_wordpress. Could that be the problem?</li>
 </ul>
 <p>If you don't know how to setup a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>");
@@ -462,10 +463,16 @@
 	 * @param string $message
 	 */
 	function bail($message) { // Just wraps errors in a nice header and footer
-		if ( !$this->show_errors )
+		if ( !$this->show_errors ) {
+			if ( class_exists('WP_Error') )
+				$this->error = new WP_Error('500', $message);
+			else
+				$this->error = $message;
 			return false;
+		}
 		wp_die($message);
 	}
+
 	/**
 	 * Checks wether of not the database version is high enough to support the features WordPress uses
 	 * @global $wp_version
Index: wp-admin/setup-config.php
===================================================================
--- wp-admin/setup-config.php	(revision 6423)
+++ wp-admin/setup-config.php	(working copy)
@@ -6,6 +6,7 @@
 
 require_once('../wp-includes/compat.php');
 require_once('../wp-includes/functions.php');
+require_once('../wp-includes/classes.php');
 
 if (!file_exists('../wp-config-sample.php'))
 	wp_die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
@@ -164,6 +165,9 @@
 
 	// We'll fail here if the values are no good.
 	require_wp_db();
+	if ( !empty($wpdb->error) )
+		wp_die($wpdb->error->get_error_message());
+
 	$handle = fopen('../wp-config.php', 'w');
 
 	foreach ($configFile as $line_num => $line) {

