Topic on Project:Support desk

Alex cmx (talkcontribs)

How can i configure the database to escape this error: 1267 Illegal mix of collations: utf8 vs cp1251?

I wanted to use cirillic symbols on the wiki.

So, when i create internal link beginnig with the letter "И" or 'и', error raises =>


[ec79bc2b15920b64df7b2aeb] /index.php?title=%D0%A1%D1%81%D1%8B%D0%BB%D0%BA%D0%B8&action=submit Wikimedia\Rdbms\DBQueryError from line 1075 of /home/htasu/hta.su/docs/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?  

Query: SELECT page_id,page_len,page_is_redirect,page_latest,page_content_model,page_namespace,page_title FROM `page` WHERE (page_namespace = '0' AND page_title = 'Интернет') 

Function: LinkHolderArray::replaceInternal

Error: 1267 Illegal mix of collations (utf8_bin,IMPLICIT) and (cp1251_general_ci,COERCIBLE) for operation '=' (htasu.mysql)

Backtrace:

#0 /home/htasu/hta.su/docs/includes/libs/rdbms/database/Database.php(933): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)

#1 /home/htasu/hta.su/docs/includes/libs/rdbms/database/Database.php(1269): Wikimedia\Rdbms\Database->query(string, string)

#2 /home/htasu/hta.su/docs/includes/parser/LinkHolderArray.php(343): Wikimedia\Rdbms\Database->select(string, array, string, string)

#3 /home/htasu/hta.su/docs/includes/parser/LinkHolderArray.php(270): LinkHolderArray->replaceInternal(string)

#4 /home/htasu/hta.su/docs/includes/parser/Parser.php(4927): LinkHolderArray->replace(string)

#5 /home/htasu/hta.su/docs/includes/parser/Parser.php(1368): Parser->replaceLinkHolders(string)

#6 /home/htasu/hta.su/docs/includes/parser/Parser.php(454): Parser->internalParseHalfParsed(string, boolean, boolean)

#7 /home/htasu/hta.su/docs/includes/content/WikitextContent.php(330): Parser->parse(string, Title, ParserOptions, boolean, boolean, NULL)

#8 /home/htasu/hta.su/docs/includes/content/AbstractContent.php(497): WikitextContent->fillParserOutput(Title, NULL, ParserOptions, boolean, ParserOutput)

#9 /home/htasu/hta.su/docs/includes/page/WikiPage.php(2071): AbstractContent->getParserOutput(Title, NULL, ParserOptions)

#10 /home/htasu/hta.su/docs/extensions/SpamBlacklist/SpamBlacklistHooks.php(37): WikiPage->prepareContentForEdit(WikitextContent)

#11 /home/htasu/hta.su/docs/includes/Hooks.php(186): SpamBlacklistHooks::filterMergedContent(RequestContext, WikitextContent, Status, string, User, boolean)

#12 /home/htasu/hta.su/docs/includes/EditPage.php(1652): Hooks::run(string, array)

#13 /home/htasu/hta.su/docs/includes/EditPage.php(2066): EditPage->runPostMergeFilters(WikitextContent, Status, User)

#14 /home/htasu/hta.su/docs/includes/EditPage.php(1493): EditPage->internalAttemptSave(NULL, boolean)

#15 /home/htasu/hta.su/docs/includes/EditPage.php(637): EditPage->attemptSave(NULL)

#16 /home/htasu/hta.su/docs/includes/actions/EditAction.php(59): EditPage->edit()

#17 /home/htasu/hta.su/docs/includes/actions/SubmitAction.php(38): EditAction->show()

#18 /home/htasu/hta.su/docs/includes/MediaWiki.php(499): SubmitAction->show()

#19 /home/htasu/hta.su/docs/includes/MediaWiki.php(293): MediaWiki->performAction(Article, Title)

#20 /home/htasu/hta.su/docs/includes/MediaWiki.php(862): MediaWiki->performRequest()

#21 /home/htasu/hta.su/docs/includes/MediaWiki.php(523): MediaWiki->main()

#22 /home/htasu/hta.su/docs/index.php(43): MediaWiki->run()

#23 {main}
MarkAHershberger (talkcontribs)

Could you give the results of "show create table page" from your database? It would also help to know your MediaWiki version, MySQL version and PHP version.

Alex cmx (talkcontribs)

php version is 5.6.6

mediawiki is 1.29.1

mySQL is mysqlnd 5.0.11

MarkAHershberger (talkcontribs)

Is this a fresh install or did you upgrade from another version? It looks like your MySQL is pretty old and should be upgraded, too.

Alex cmx (talkcontribs)

it's fresh install. I've just started experimenting in web, so i don't understand many things...

MarkAHershberger (talkcontribs)

Is this on shared hosting? Do you have access to phpMyAdmin or something similar?

Alex cmx (talkcontribs)

sorry, mysql version is 5.7.17, and yes i have access to phpMyAdmin

This post was hidden by 2003:CC:ABCA:4500:14DA:EB6A:80B5:3D6E (history)
2003:CC:ABCA:4500:6C82:D7A8:4772:450D (talkcontribs)

Which tables and columns are using cp1251 as a collation? I think these tables and columns are problematic.

Is there only the new MediaWiki installation inside that database? Or is there also something else in it and you may be using both systems together? If it is only this new wiki, I would empty the database, then make sure the collation for new tables is utf8_general_ci and then let MediaWiki install its things into the database again.

However, I am still unsure, for why the tables had not been created with fitting collations right away. I think the installer should offer utf8 and binary only, not cp1251. utf8 and binary both are ok, but a mix with cp1251 should not be there.

This post was hidden by Ciencia Al Poder (history)