I am constantly bugged by spammers in my 15 Monkeys wiki farm[1, 2], but I wasn’t allowed to protect the victim pages anymore. So, I wondered where my Sysop rights had gone.

Turned out they weren’t gone:

SELECT user_id, user_name, CONCAT( '"', ug_group, '"' ) AS ug_group_quoted
FROM mw_nl_user_groups
INNER JOIN mw_nl_user ON ( ug_user = user_id )
user_iduser_nameug_group_quoted
1BigSmoke"bureaucrat "
1BigSmoke"sysop "

They were just padded a bit. I have had a similar problem with MediaWiki before, so I remembered where to look within the hour this time. 😉 I tried a quick fix:

UPDATE mw_nl_user_groups SET ug_group = rtrim(ug_group);

I was surprised to see in phpMyAdmin that the values where now no longer padded with spaces, but with null-bytes (“\0“) instead. I tried to fix this untill I found out that this is the normal behaviour in MySQL 5.0.15. The MySQL documentation also mentions that, before 5.0.15, VARBINARY values were padded with spaces instead. Apparently, my mystery problems with padding were never caused by MediaWiki but by MySQL itself… PostgreSQL, where are you when I need you?

My advice: don’t run your own database-backed CMS if you don’t have at least rudimentary DBA skills.

The suckiness is: this time, the problem isn’t solved by just converting the padding. 🙁 I’ll have to look into it some further.