diff --git a/tests/drush_testcase.inc b/tests/drush_testcase.inc
index dfe2dc5..8e51b1e 100644
--- a/tests/drush_testcase.inc
+++ b/tests/drush_testcase.inc
@@ -357,8 +357,22 @@ abstract class Drush_UnitTestCase extends Drush_TestCase {
  * Initialize our environment at the start of each run (i.e. suite).
  */
 function unish_init() {
+  $unish_db_url = !empty($GLOBALS['UNISH_DB_URL']) ? $GLOBALS['UNISH_DB_URL'] : NULL;
   // We read from globals here because env can be empty and ini did not work in quick test.
-  define('UNISH_DB_URL', getenv('UNISH_DB_URL') ? getenv('UNISH_DB_URL') : !empty($GLOBALS['UNISH_DB_URL']) ? $GLOBALS['UNISH_DB_URL'] : 'mysql://root:@127.0.0.1');
+  $unish_db_url = getenv('UNISH_DB_URL') ? getenv('UNISH_DB_URL') : $unish_db_url;
+
+  // Try to read db creds from ~/.my.cnf.
+  $my_cnf_path = $_SERVER['HOME'] . '/.my.cnf';
+  $my_cnf = array();
+  if (file_exists($my_cnf_path)) {
+    $my_cnf = parse_ini_file($_SERVER['HOME'] . '/.my.cnf');
+  }
+
+  $db_user = isset($my_cnf['user']) ? $my_cnf['user'] : 'root';
+  $db_pass = isset($my_cnf['password']) ? $my_cnf['password'] : '';
+  $unish_db_url = $unish_db_url ? $unish_db_url : 'mysql://' . $db_user . ':' . $db_pass . '@127.0.0.1';
+
+  define('UNISH_DB_URL', $unish_db_url);
 
   // UNISH_DRUSH value can come from phpunit.xml or `which drush`.
   if (!defined('UNISH_DRUSH')) {
