MySQL AlphaID Function
The easiest way to do this with built-in functions would be to just convert the number into base 36:

mysql&gt; select conv(9223372036854775807,10,36);
+---------------------------------+
| conv(9223372036854775807,10,36) |
+---------------------------------+
| 1Y2P0IJ32E8E7                   |
+---------------------------------+
1 row in set (0.00 sec)

mysql&gt;


This allows use of 0-9 A-Z, and is the largest base supported by CONV().

To convert back:

mysql&gt; select conv('1Y2P0IJ32E8E7', 36, 10);
+-------------------------------+
| conv('1Y2P0IJ32E8E7', 36, 10) |
+-------------------------------+
| 9223372036854775807           |
+-------------------------------+
1 row in set (0.00 sec)

mysql&gt;


Documentation for CONV here. 

See here, if you don't know how bases work.