Hi
Maybe that can help (if you work with root). I had that with MariaDB
PS: working with root is not recommended
Please check in de Database mysql and table user.
For example:
if you have the “unix_socket” plugin → only allow form unix.
Add an other user and give them all premissons to the database (exept GRANT)
And try again.
check also the nextcloud/config/config.php