Manual talk:User groups table

From mediawiki.org
Latest comment: 8 years ago by Tenbergen in topic How do I resolve the group names?

How do I resolve the group names?[edit]

When I run "SELECT DISTINCT ug_group FROM user_groups;" I just get a list of numbers, e.g. 617070726f766564. How do I resolve these into the group names? Is there a separate lookup table, and if so which? The main article makes it sound like these should be text... Thanks!Tenbergen (talk) 14:33, 16 July 2015 (UTC)Reply

No, there is no lookup table or so; the group names, which are in the user_groups table are in fact, what is assigned to the users.
I have just checked that in a DB of mine and the query gives me the group names as readable text. I guess that your problem arises from the fact that the ug_group column in the database is binary. You should be able to convert its content by using CONVERT or CAST in MySQL. E.g.
SELECT DISTINCT CONVERT(`ug_group` USING utf8) FROM `user_groups`;
I have not tested that, but that is basically how it should work. --88.130.86.163 01:39, 20 July 2015 (UTC)Reply
Worked, thanks! Had to change it to "... from mw_user_groups" because that's how Installatron names Mediawiki tables, but that's idiosyncratic. Tenbergen (talk) 15:05, 20 July 2015 (UTC)Reply