MySQL:存储MAC地址的最佳方法? [英] MySQL: Best way to store MAC addresses?

查看:980
本文介绍了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');

这篇关于MySQL:存储MAC地址的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆