I got the database connection error while installing Magento in the 3 Screen where it ask u for the database username and password.
i done the google and find this solutions
1. Give write permisions to config file "/app/etc/config.xml"
2. Magento work on innoDB table so go to "/etc/mysql/" and allow MYSQL to create InnoDB tables
#skip-innodb to skip-innodb
and then continue the installations this help me hope help u also..