MySQL Database and PHP program installed on the same server, PHP connection to the database, db_host write localhost, or this server's IP?
Reply content:
MySQL Database and PHP program installed on the same server, PHP connection to the database, db_host write localhost, or this server's IP?
The same server is completely unnecessary to write dead machine IP, the machine's IP will change.
Write localhost, or 127.0.0.1.
IP address write 127.0.0.1 or localhost is OK, the other unchanged ...
As long as you do not write the public network IP, LAN IP may also go through the network card and routing, recommended 127.0.0.1
or locahost
.
Landlord refers to the server is the cloud host or virtual host, the cloud host, according to the answer is basically no problem, if it is a virtual host, the database link needs to provide the database address, user name, password and database name
127.0.0.1 local Use this on the line.