Error about establishing a database connection

I downloaded WordPress and set up a database and user and input the information required in wd-config.php per instructions. Now, I get an error about establishing a database connection when I try to go to install.php. The database server is running, and I’m sure the user, pass, and hostname are correct. Running on localhost with PHP 7.1.23 and MySQL 8.0.17. How can I fix this?

First of all, make sure that your database server is running.
Input database name, database user and password without any space as shown in the screenshot.