Outputting mac address as standard format in mysql
After reading some research, I understand that mac addresses stored in mysql should be stored as BIG INT. Is there an easy way to output the mac's in the standard hex form: ab:23:a4:23:54:33 when using a SELECT statement?
I know I can use hex() to convert format to hexadecimal, but i'd like the full 6 bytes and colons. thanks.
SELECT hex(macAddress) from <table>;
if you have your macAddress stored as a string you can use the following text conversion.
SELECT mac, concat(left(mac,2), ":",substring(mac,3,2), ":" , substring(mac,5,2), ":",substring(mac,7,2), ":",substring(mac,9,2), ":", right(mac,2)) as mac_colons FROM mac_table;