How to store an IP in mySQL

前端 未结 7 454
情话喂你
情话喂你 2020-12-02 19:00

We\'ve got a healthy debate going on in the office this week. We\'re creating a Db to store proxy information, for the most part we have the schema worked out except for how

相关标签:
7条回答
  • 2020-12-02 19:49

    Old thread, but for the benefit of readers, consider using ip2long. It translates ip into an integer.

    Basically, you will be converting with ip2long when storing into DB then converting back with long2ip when retrieving from DB. The field type in DB will INT, so you will save space and gain better performance compared to storing ip as a string.

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