Getting connection failed: php_network_getaddresses: getaddrinfo failed: Name or service not known
Thanks Prerak, This is the answer, my database is on the same machine so I just needed to edit: Now everything is working just fine.
Thanks Prerak, This is the answer, my database is on the same machine so I just needed to edit: Now everything is working just fine.
You’re missing service name: EDIT If you can connect to the database from other computer try running there: and
Are you connecting to “localhost” or “127.0.0.1” ? I noticed that when you connect to “localhost” the socket connector is used, but when you connect to “127.0.0.1” the TCP/IP connector is used. You could try using “127.0.0.1” if the socket connector is not enabled/working.
This code should work: Also in connect 2.0 .createServer() method deprecated. Use connect() instead.