Hi,
This is pasted direct from another thread that I responded too:
--
This is likely because you have some of your database details entered wrong or a permission issue whilst trying to connect.
Can you check in you var/log/exception.log file to see if there are any errors in there?
If you don't see anything in there... edit the file app\code\core\Mage\Install\Model\Installer\Db.php and find the below code:
Mage::throwException(Mage::helper('install')->__('Database connection error.'));
Change it too:
Mage::throwException(Mage::helper('install')->__($e->getMessage()));
This time when you try it should output some error message indicating which part of your setup was wrong.
Let us know how you get on.