bWAPP: Connection failed: "Access denied for user 'root'@'localhost'" when clicking install

Solution 1:

The reason is MariaDB database backend which comes installed with Kali Linux:

MariaDB is a community-developed fork of the MySQL relational database management system intended to remain free under the GNU GPL.

This database backend doesn't allow root@localhost user access from applications.

I fixed the issue by creating a new database user, bwappu, with granted priviledges for the bwapp database:

GRANT ALL PRIVILEGES on bwapp.* to 'bwappu'@'localhost';

Also, see this post: https://stackoverflow.com/questions/28068155/access-denied-for-user-rootlocalhost-using-password-yes-after-new-instal

Solution 2:

A little bit more detalization for correct answer by Nicolas Lykke Iversen:

Go to the terminal:

root@kali: mysql -u root -p
enter password 'toor'
MariaDB [(none)]> use mysql;
MariaDB[(mysql)]> create user 'username'@'localhost' identified by 'my_password';
MariaDB[(mysql)]> grant all privileges on bWAPP.* to 'username'@'localhost' identified by 'my_password';

Go to /var/www/html/bWAPP/admin/settings.php and set:

$db_username = "username";
$db_password = "my_password";

Then go to http://localhost/bWAPP/install.php and install it.

PS: username & my_password - you may use any words you like