PHP MYSQL - Difference between 127.0.0.1 and localhost

后端 未结 1 1905
情深已故
情深已故 2021-01-11 14:14

I am encountering a strange problem on my imac running OS X. For my frameworks and CMS configuration files if I use host: localhost (in db settings) an error is produced and

相关标签:
1条回答
  • 2021-01-11 14:26

    localhost will cause the MySQL client to try a UNIX socket in a standard directory. If that doesn't exist or is somewhere else, you won't be able to connect. 127.0.0.1 always uses a TCP connection.

    See the manual, C.5.2.2. Can't connect to [local] MySQL server.

    0 讨论(0)
提交回复
热议问题