Set up a MediaWiki and registered a username. What to name it? I'll face-roll one.
Later I realized this username also serves as the login name, and since my face is too big, I accidentally made the username too long. What to do? Change it!
This stuff is stored in MySQL (of course you can use another database; it’s all the same). So just hop into MySQL and take a look.
The first table to check is user (of course, some setups use a prefix, in which case it’s the “prefix_user” table).
Update a row:
update user set user_name = "新名字" where user_id = 1;Then I logged in smoothly, only to find the edit failed — wow, that’s harsh. I Googled right away. But the results were all about changing passwords; the occasional name-change post didn’t make much sense. After tweaking the keywords many times, I finally found a guy several pages in who had also changed his name. I tried his approach, and it worked.
As we all know, MediaWiki is a great pal for recording all kinds of scattered bits of information, so after setting things up I immediately went in and edited the main page and such. As a result, this good pal saved all my record info. In other words, the username gets recorded in various places, including revision. Every time you log in, the system checks whether the contents of the user table match the other stuff. If they don’t match, it simply trashes all my hard work.
So to truly fix it, after modifying the user table you also need to update the related records in the revision table.
Here are all the SQL statements for changing the username:
update user set user_name = '新名字' where user_name = '旧名字';
update revision set rev_user_text = '新名字' where rev_user_text = '旧名字';
update recentchanges set rc_user_text = '新名字' where rc_user_text = '旧名字';Reminder again: don’t forget the table name prefix.
Also, one more thing to note:
If your face-rolled name is in English, the value here should be capitalized — yes, that’s how MediaWiki is configured. Usernames that start with a lowercase letter are all converted to start with an uppercase letter when querying, which is slightly annoying.
Comments · 4