{"id":82,"date":"2014-08-17T14:59:16","date_gmt":"2014-08-17T21:59:16","guid":{"rendered":"http:\/\/pronoiac.org\/misc\/?p=82"},"modified":"2014-08-17T15:01:52","modified_gmt":"2014-08-17T22:01:52","slug":"server-on-fire","status":"publish","type":"post","link":"https:\/\/pronoiac.org\/misc\/2014\/08\/server-on-fire\/","title":{"rendered":"Server on fire"},"content":{"rendered":"<p>Note: I&#8217;m in the midst of a web developer bootcamp. I feel like writing this up to help others, but I&#8217;m going to show the sausage getting made, because (1) I&#8217;m not sure I&#8217;d cover everything, and having all the details might help others in this position, and (2) I don&#8217;t have the time to make it more concise.<\/p>\n<p><b>As background:<\/b> I run a few websites, some for myself, and some for other people. When the sites for other people break, I pay more attention. And when I check the traffic to see what&#8217;s being requested, and the most frequent is <a href=\"http:\/\/mefiwiki.com\/wiki\/ThereIsHelp\">a page for suicide and depression prevention resources,<\/a> right after Robin Williams&#8217; taking his own life, when the resources could be <i>timely and helpful,<\/i> well, that <i>really<\/i> lit a fire under me.<!--more Some sysadmin geekery ensued... --><\/p>\n<p>So, a MediaWiki installation died, after months of puttering along, citing a database error: &#8220;A database query error has occurred.&#8221; My thought is that the hosting company updated something, and usually, a quick software update handles it. Not this time, though. Some googling <a href=\"http:\/\/www.mediawiki.org\/wiki\/Thread:Project:Support_desk\/Database_error_in_upgrading_from_1.18_to_1.22\">suggested<\/a> adding &#8220;$wgShowSQLErrors = 1;&#8221; at the end of LocalSettings.php &#8211; which I should add to the <a href=\"http:\/\/www.mediawiki.org\/wiki\/Manual:Errors_and_symptoms\">MediaWiki errors page.<\/a> Following that led to the more informative error: &#8220;1267 Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci&#8221;,COERCIBLE) for operation &#8216;=&#8217; (<i>(snip out my database server<\/i>)&#8221;<\/p>\n<p>My Mediawiki installation fell over due to a database problem involving mismatched collations; utf8 and, for some reason, latin1_swedish_ci. I followed <a href=\"http:\/\/alexking.org\/blog\/2008\/03\/06\/mysql-latin1-utf8-conversion\">some steps based on Alex King&#8217;s notes on a similar situation,<\/a> with some modifications.<\/p>\n<p>1. &#8220;Export the data as Latin-1.&#8221; I usually use phpmyadmin, but that &#8216;Latin-1&#8217; wasn&#8217;t a listed export option. So, I used the command line, starting from <a href=\"http:\/\/airbladesoftware.com\/notes\/fixing-mysql-illegal-mix-of-collations\">these directions<\/a> as a starting basis:<br \/>\n<code>mysqldump -u<em>USER<\/em> -p --quick --single-transaction --create-options --skip-set-charset --default-character-set=latin1 -h <em>DB_SERVER<\/em> <em>TABLE_NAME<\/em> &gt; db-dump.sql<\/code><br \/>\nI opted to enter the database password interactively, so it wouldn&#8217;t be saved in the shell history. <\/p>\n<p>2. &#8220;Change the character set in the exported data file from &#8216;latin1&#8217; to &#8216;utf8&#8217;.&#8221; I used nano to edit, find and replace: latin1 to utf8, and latin1_bin to utf8_bin. Textmate <em>might<\/em> have worked, but it asked about character set encodings, and so I worried it could screw things up.<\/p>\n<p>3. See #2.<\/p>\n<p>4. &#8220;Import your data normally.&#8221; phpmyadmin on the usual host balked at the 15 meg bzipped database file, and I&#8217;d hit my breaking point with this hosting, so I set up a Linode instead. Based on the <a href=\"https:\/\/www.linode.com\/docs\/websites\/hosting-a-website#importing-a-database\">Linode import directions:<\/a> <code>mysql -u <em>USERNAME<\/em> -p -h <em>DB_SERVER<\/em> <em>DB_NAME<\/em> &lt; <em>FILE.sql<\/em><\/code> &#8211; again, interactively prompted for the database password. <\/p>\n<p>Lastly: there <strong>may<\/strong> be an <a href=\"http:\/\/airbladesoftware.com\/notes\/fixing-truncated-accented-text\">issue with accented characters, causing truncated pages.<\/a> I tried to grep the logs, but the lines are too long. I looked at the Google results for each accented letter, and nothing looked amiss. I started looking at hexdumps, and there were a <em>lot<\/em> of results, from old spam. I&#8217;ve punted on this, and asked the wiki mods and the Mefi mods to let me know if anything breaks. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Note: I&#8217;m in the midst of a web developer bootcamp. I feel like writing this up to help others, but I&#8217;m going to show the sausage getting made, because (1) I&#8217;m not sure I&#8217;d cover everything, and having all the details might help others in this position, and (2) I don&#8217;t have the time to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-82","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/pronoiac.org\/misc\/wp-json\/wp\/v2\/posts\/82"}],"collection":[{"href":"https:\/\/pronoiac.org\/misc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pronoiac.org\/misc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pronoiac.org\/misc\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pronoiac.org\/misc\/wp-json\/wp\/v2\/comments?post=82"}],"version-history":[{"count":16,"href":"https:\/\/pronoiac.org\/misc\/wp-json\/wp\/v2\/posts\/82\/revisions"}],"predecessor-version":[{"id":103,"href":"https:\/\/pronoiac.org\/misc\/wp-json\/wp\/v2\/posts\/82\/revisions\/103"}],"wp:attachment":[{"href":"https:\/\/pronoiac.org\/misc\/wp-json\/wp\/v2\/media?parent=82"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pronoiac.org\/misc\/wp-json\/wp\/v2\/categories?post=82"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pronoiac.org\/misc\/wp-json\/wp\/v2\/tags?post=82"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}