17/02/2008
SIP Express router, mysql and utf8
Description:
There’s a small problem when using SIP Express Router (net-misc/ser on Gentoo) with mysql support and your mysql server uses utf8 as a default character set (gentoo’s latest versions use utf8 by default).
The problem:
One of ser’s scripts (ser_mysql.sh) can’t handle utf8 tables.
# ser_mysql.sh create
MySql password for root:
Domain (realm) for the default user 'admin': foobar
creating database ser ...
ERROR 1071 (42000) at line 100: Specified key was too long; max key length is 1000 bytes
Solution 1 (remove utf8):
Change the character set to latin1.
The specified error can easily be “fixed” by editing /usr/sbin/ser_mysql.sh. Inside that script you will find a line like this (line 38):
TABLE_TYPE="TYPE=MyISAM"
replace it with:
TABLE_TYPE="TYPE=MyISAM,DEFAULT CHARACTER SET latin1"
The result:
# ser_mysql.sh create
MySql password for root:
Domain (realm) for the default user 'admin': foobar
creating database ser ...
Solution 2 (reduce some column sizes):
The following solution makes the script run but I have not personally tested if ser STILL works ok after the changes. Feel free to experiment and comment back on this:
# sed -i 's|domain varchar(128|domain varchar(100|g' /usr/sbin/ser_mysql.sh
# sed -i 's|contact varchar(255|contact varchar(128|g' /usr/sbin/ser_mysql.sh
Filed by kargig at 22:32 under Gentoo,Linux,VoIP
1 Comment | 6,244 views
The bug report on this is at
http://bugs.mysql.com/bug.php?id=4541
It should be fixed in a proper manner in mysql; using hashes instead of the verbatim values for keys.