Why does the database configuration have to be filled with IP in the wordpress project built by linux?

I built a linux virtual machine locally, and then deployed the wordpress project. Why? when I visited the project locally, I prompted that the database link failed, and then I changed the localhost of the DB_HOST configured in the database to the IP of linux. Why is this

?
May.10,2021

check whether the / etc/hosts file is configured
127.0.0.1 localhost

Menu