MySQL:存储MAC地址的最佳方法?
问题描述:
用于在MySQL数据库中存储MAC地址的最佳字段类型是什么?另外,应该使用特定的分隔符(冒号或破折号)存储还是不使用分隔符存储?
What's the best field type to use to store MAC addresses in a MySQL database? Also, should it be stored with a certain separator (colon or dash) or should it be stored without a separator?
答
使用bigint无符号(8个字节),则可以:
use bigint unsigned (8 bytes) then you can:
select hex(mac_addr) from log;
和
insert into log (mac_addr) values (x'000CF15698AD');