{"id":161,"date":"2009-10-03T16:57:22","date_gmt":"2009-10-03T20:57:22","guid":{"rendered":"http:\/\/linuxhostingsupport.net\/blog\/?p=161"},"modified":"2013-03-20T08:40:12","modified_gmt":"2013-03-20T12:40:12","slug":"howto-change-collation-for-mysql","status":"publish","type":"post","link":"https:\/\/linuxhostingsupport.net\/blog\/howto-change-collation-for-mysql","title":{"rendered":"Howto: change collation for mysql"},"content":{"rendered":"<p>People may think of <strong>changing &#8220;collation&#8221; for their Mysql<\/strong> databases and here how to change it. First, there are two ways to check the current collation on your server. One from the command line and one from the mysql prompt:<\/p>\n<blockquote><p><span style=\"color: #993300;\"><strong>root@server [~]# mysqladmin variables | grep collation<br \/>\n| collation_connection            | utf8_general_ci                        |<br \/>\n| collation_database              | utf8_general_ci                        |<br \/>\n| collation_server                | utf8_general_ci                        |<\/strong><\/span><\/p><\/blockquote>\n<p><strong>OR<\/strong><\/p>\n<blockquote><p><span style=\"color: #993300;\"><strong>mysql&gt; SHOW VARIABLES LIKE &#8216;collation%&#8217;;<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n| Variable_name        | Value           |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n| collation_connection | utf8_general_ci |<br \/>\n| collation_database   | utf8_general_ci |<br \/>\n| collation_server     | utf8_general_ci |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n3 rows in set (0.00 sec)<\/strong><\/span><\/p><\/blockquote>\n<p>As you can see the <strong>current collation is set to &#8220;utf8_general_ci&#8221;<\/strong>.<\/p>\n<p>In order to change it to something for example &#8220;latin1_general_ci&#8221;, <strong>edit your \/etc\/my.cnf<\/strong> file and place the following code:<\/p>\n<blockquote><p><span style=\"color: #993300;\"><strong>collation-server=latin1_general_ci<\/strong><\/span><\/p><\/blockquote>\n<p>Save the file and <strong>restart mysql service<\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>People may think of changing &#8220;collation&#8221; for their Mysql databases and here how to change it. First, there are two ways to check the current collation on your server. One from the command line and one from the mysql prompt:<br \/>\nroot@server [~]# mysqladmin variables | grep collation<br \/>\n| collation_connection            | utf8_general_ci                        |<br \/>\n| collation_database    [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[111],"tags":[180,181,179,182,178,183],"_links":{"self":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/161"}],"collection":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/comments?post=161"}],"version-history":[{"count":2,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/161\/revisions"}],"predecessor-version":[{"id":2131,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/161\/revisions\/2131"}],"wp:attachment":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/media?parent=161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/categories?post=161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/tags?post=161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}