Other than making sure you are using nextcloud for both the database name and the database username.
What about trying to manually connect to the database via shell?
mysql -u nextcloud -p'YOURPASSWORD'
...you can then type
show databases; to see if the nextcloud database does in fact exist.
If you can, then something is being entered wrong, ie; user error.