Error: connect ECONNREFUSED 127.0.0.1:3306

The reason for this is that you cannot connect to MySQL with the root account anymore. This rule was changed — and enforced — within MySQL starting a few years ago. While it is possible to update the configuration to allow it, it is strongly discouraged even for development environments.

Instead, if you need the application to have complete control over a database, you can create an account and give it full control like this:

CREATE USER 'app_name'@'localhost' IDENTIFIED WITH mysql_native_password BY 'superSecretPassword!123';
GRANT ALL ON `database`.* TO 'app_name'@'localhost';

In the event you want the application to have even more control, you can allow it access to everything, including the ability to create new accounts, like this:

GRANT ALL ON *.* TO 'app_name'@'localhost' WITH GRANT OPTION;