{"id":2342,"date":"2013-05-14T00:46:50","date_gmt":"2013-05-14T08:46:50","guid":{"rendered":"http:\/\/www.mysqltutorial.org\/?page_id=2342"},"modified":"2023-10-23T02:53:42","modified_gmt":"2023-10-23T09:53:42","slug":"mysql-collation","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-collation\/","title":{"rendered":"MySQL Collation"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn about <strong>MySQL collation<\/strong> and how to set character sets and collations for the MySQL server, database, table, and column.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction to MySQL collation<\/h2>\n\n\n\n<p>A MySQL collation is a set of rules used to compare characters in a particular <a title=\"MySQL Character Set\" href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-character-set\/\">character set<\/a>. Each character set in MySQL has at least one default collation. It can have more than one collation. However, two character sets cannot have the same collation.<\/p>\n\n\n\n<p>MySQL provides the <code>SHOW CHARACTER SET<\/code>&nbsp; statement that allows you to get the default collations of character sets:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SHOW<\/span> <span class=\"hljs-built_in\">CHARACTER<\/span> <span class=\"hljs-keyword\">SET<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"414\" height=\"308\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/mysql-character-sets.png\" alt=\"MySQL character sets\" class=\"wp-image-2336\" title=\"MySQL character sets\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/mysql-character-sets.png 414w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/mysql-character-sets-300x223.png 300w\" sizes=\"auto, (max-width: 414px) 100vw, 414px\" \/><\/figure>\n\n\n\n<p>The values of the default collation column specify the default collations for the character sets.<\/p>\n\n\n\n<p>By convention, a collation for a character set begins with the character set name and ends with <code>_ci<\/code> (case insensitive) <code>_cs<\/code> &nbsp;(case sensitive) or <code>_bin<\/code> &nbsp;(binary).<\/p>\n\n\n\n<p>To get all collations for a given character set, you use the <code>SHOW COLLATION<\/code> &nbsp;statement as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SHOW<\/span> <span class=\"hljs-keyword\">COLLATION<\/span> <span class=\"hljs-keyword\">LIKE<\/span> <span class=\"hljs-string\">'character_set_name%'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>For example, the following statement gets all collations for the <code>latin1<\/code> character set:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SHOW<\/span> <span class=\"hljs-keyword\">COLLATION<\/span> <span class=\"hljs-keyword\">LIKE<\/span> <span class=\"hljs-string\">'latin1%'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image alignnone size-full wp-image-2348\"><img loading=\"lazy\" decoding=\"async\" width=\"432\" height=\"196\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/mysql-collation.png\" alt=\"MySQL Collation\" class=\"wp-image-2348\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/mysql-collation.png 432w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/mysql-collation-300x136.png 300w\" sizes=\"auto, (max-width: 432px) 100vw, 432px\" \/><figcaption class=\"wp-element-caption\">MySQL Collations for latin1 Character Set<\/figcaption><\/figure>\n\n\n\n<p>As mentioned above, each character set has a default collation e.g., <code>latin1_swedish_ci<\/code> is the default collation of the <code>latin1<\/code> character set.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Setting character sets and collations<\/h2>\n\n\n\n<p>MySQL allows you to specify character sets and collations at four levels: <\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Server<\/li>\n\n\n\n<li>Database<\/li>\n\n\n\n<li>Table<\/li>\n\n\n\n<li>Column<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">1) Setting character sets and collations at the server Level<\/h3>\n\n\n\n<p>MySQL uses the <code>latin1<\/code> as the default character set. Therefore, the default collation is <code>latin1_swedish_ci<\/code>. You can change these settings at server startup.<\/p>\n\n\n\n<p>If you specify one character set at server startup, MySQL will use the default collation of that character set. However, if you specify both a character set and a collation explicitly, MySQL will use the character set and collation for all databases that you will create.<\/p>\n\n\n\n<p>The following statement sets the utf8 character set and <code>utf8_unicode_cs<\/code> collation for the server via the command line:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">&gt;mysqld <span class=\"hljs-comment\">--character-set-server=utf8 --collation-server=utf8_unicode_cs<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\">2) Setting character sets and collations at the database level<\/h3>\n\n\n\n<p>When you <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-create-database\/\">create a database<\/a> but do not specify the character set and collation, MySQL will use the default character set and collation of the server for the new database.<\/p>\n\n\n\n<p>You can override the default settings at the database level by using <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-create-database\/\">CREATE DATABASE<\/a><\/code> statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">DATABASE<\/span> database_name\n<span class=\"hljs-built_in\">CHARACTER<\/span> <span class=\"hljs-keyword\">SET<\/span> character_set_name\n<span class=\"hljs-keyword\">COLLATE<\/span> collation_name;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>or using the <code>ALTER DATABASE<\/code> statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">ALTER<\/span> <span class=\"hljs-keyword\">DATABASE<\/span> database_name\n<span class=\"hljs-built_in\">CHARACTER<\/span> <span class=\"hljs-keyword\">SET<\/span> character_set_name\n<span class=\"hljs-keyword\">COLLATE<\/span> collation_name;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>MySQL will use the database&#8217;s character set and collation by default for the tables that you create in the database.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3) Setting character sets and collations at the table level<\/h3>\n\n\n\n<p>A database may contain tables with character sets and collations that are different from the database&#8217;s character set and collation.<\/p>\n\n\n\n<p>You can specify the default character set and collation for a table when you create the table by using the <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-create-table\/\">CREATE TABLE<\/a><\/code> statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> table_name(\n   ...\n)\n<span class=\"hljs-built_in\">CHARACTER<\/span> <span class=\"hljs-keyword\">SET<\/span> character_set_name\n<span class=\"hljs-keyword\">COLLATE<\/span> collation_name;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>or when you alter the table using the <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-alter-table\/\">ALTER TABLE<\/a><\/code> &nbsp;statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">ALTER<\/span> <span class=\"hljs-keyword\">TABLE<\/span> table_name(\n  ...\n)\n<span class=\"hljs-built_in\">CHARACTER<\/span> <span class=\"hljs-keyword\">SET<\/span> character_set_name\n<span class=\"hljs-keyword\">COLLATE<\/span> collation_name;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\">4) Setting character set and collation at column level<\/h3>\n\n\n\n<p>A column of type <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-char-data-type\/\">CHAR<\/a><\/code> , <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-varchar\/\">VARCHAR<\/a><\/code> or <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-text\/\">TEXT<\/a><\/code> can have its own character set and collation different from the table&#8217;s character set and collation.<\/p>\n\n\n\n<p>The <code>CREATE TABLE<\/code> and <code>ALTER TABLE<\/code> statement allows you to override the character set and collation for a specific column:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">column_name &#91;CHAR | VARCHAR | TEXT] (length)\nCHARACTER <span class=\"hljs-keyword\">SET<\/span> character_set_name\n<span class=\"hljs-keyword\">COLLATE<\/span> collation_name<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The rules for setting the character set and collation are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If you specify both a character set and a collation explicitly, the character set and collation are used.<\/li>\n\n\n\n<li>If you specify a character set and omit the collation, the default collation of the character set is used.<\/li>\n\n\n\n<li>If you specify a collation without a character set, the character set associated with the collation is used.<\/li>\n\n\n\n<li>If you omit both character set and collation, the default character set and collation are used.<\/li>\n<\/ul>\n\n\n\n<p>Let&#8217;s take a look at some examples of setting the character sets and collations.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Examples of setting character sets and collations<\/h2>\n\n\n\n<p>First, create a new database with utf8 as the character set and <code>utf8_unicode_ci<\/code> as the default collation:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">DATABASE<\/span> mydb\n<span class=\"hljs-built_in\">CHARACTER<\/span> <span class=\"hljs-keyword\">SET<\/span> utf8\n<span class=\"hljs-keyword\">COLLATE<\/span> utf8_unicode_ci;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Because we specify the character set and collation for the <code>mydb<\/code> database explicitly, the <code>mydb<\/code> won&#8217;t take the default character set and collation of the database server.<\/p>\n\n\n\n<p>Second, create a new table named <code>t1<\/code> in the <code>mydb<\/code> database:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">USE<\/span> mydb;\n\u00a0\n<span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> t1(\n    c1 <span class=\"hljs-built_in\">char<\/span>(<span class=\"hljs-number\">25<\/span>)\n);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this <code>CREATE TABLE<\/code> statement, we don&#8217;t specify the character set and collation for the <code>t1<\/code> table. Therefore, MySQL will use the character set and collation of the database for the <code>t1<\/code> table. In this case, the <code>t1<\/code> &nbsp;table will have <code>utf8<\/code> as the default character set and <code>utf8_unicode_ci<\/code> as the default collation.<\/p>\n\n\n\n<p>Third, change the character set and collation of the table <code>t1<\/code> to <code>latin1<\/code> and <code>latin1_german1_ci<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">ALTER<\/span> <span class=\"hljs-keyword\">TABLE<\/span> t1\n<span class=\"hljs-built_in\">CHARACTER<\/span> <span class=\"hljs-keyword\">SET<\/span> latin1\n<span class=\"hljs-keyword\">COLLATE<\/span> latin1_german1_ci;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>c1<\/code> column in the <code>t1<\/code> table has <code>latin1<\/code> as the character set and <code>latin1_german1_ci<\/code> as the collation.<\/p>\n\n\n\n<p>Finally, change the character set of the <code>c1<\/code> column to <code>latin1<\/code> :<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">ALTER<\/span> <span class=\"hljs-keyword\">TABLE<\/span> t1\n<span class=\"hljs-keyword\">MODIFY<\/span> c1 <span class=\"hljs-built_in\">VARCHAR<\/span>(<span class=\"hljs-number\">25<\/span>)\n<span class=\"hljs-built_in\">CHARACTER<\/span> <span class=\"hljs-keyword\">SET<\/span> latin1;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Now, the <code>c1<\/code> column has the&nbsp;<code>latin1<\/code>&nbsp; character set, but what about its collation? Is it inheriting the <code>latin1_german1_ci<\/code> collation from the table&#8217;s collation? <\/p>\n\n\n\n<p>The answer is no. The reason is that the default collation of the <code>latin1<\/code> character set is <code>latin1_swedish_ci<\/code>, therefore, the <code>c1<\/code> column will have the&nbsp;<code>latin1_swedish_ci<\/code> collation.<\/p>\n\n\n\n<p>In this tutorial, you have learned about MySQL collation and how to specify character sets and collations for the MySQL server, databases, tables, and columns.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Reference<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/charset.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/charset.html<\/a> &#8211; MySQL character set support<\/li>\n\n\n\n<li><a href=\"http:\/\/collation-charts.org\/mysql60\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">http:\/\/collation-charts.org\/mysql60\/<\/a>&nbsp;&#8211;&nbsp;MySQL collation charts<\/li>\n<\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful? <\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"2342\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-collation\/\"\n\t\t\t\tdata-post-title=\"MySQL Collation\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"2342\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-collation\/\"\n\t\t\t\tdata-post-title=\"MySQL Collation\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial discusses about MySQL Collation and shows you how to set character set and collations for the MySQL server, database, tables and columns.<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":174,"menu_order":84,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-2342","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MySQL Collation - Setting Character Sets and Collations in MySQL<\/title>\n<meta name=\"description\" content=\"You will learn about MySQL collation and how to set character sets and collations for the server, database, table, and column.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mysqltutorial.org\/mysql-collation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL Collation - Setting Character Sets and Collations in MySQL\" \/>\n<meta property=\"og:description\" content=\"You will learn about MySQL collation and how to set character sets and collations for the server, database, table, and column.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/mysql-collation\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-23T09:53:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/mysql-character-sets.png\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-collation\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-collation\\\/\",\"name\":\"MySQL Collation - Setting Character Sets and Collations in MySQL\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-collation\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-collation\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2013\\\/05\\\/mysql-character-sets.png\",\"datePublished\":\"2013-05-14T08:46:50+00:00\",\"dateModified\":\"2023-10-23T09:53:42+00:00\",\"description\":\"You will learn about MySQL collation and how to set character sets and collations for the server, database, table, and column.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-collation\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-collation\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-collation\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2013\\\/05\\\/mysql-character-sets.png\",\"contentUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2013\\\/05\\\/mysql-character-sets.png\",\"width\":414,\"height\":308,\"caption\":\"mysql character sets\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-collation\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL Basics\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-basics\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"MySQL Collation\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\",\"name\":\"MySQL Tutorial\",\"description\":\"A comprehensive MySQL Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mysqltutorial.org\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MySQL Collation - Setting Character Sets and Collations in MySQL","description":"You will learn about MySQL collation and how to set character sets and collations for the server, database, table, and column.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mysqltutorial.org\/mysql-collation\/","og_locale":"en_US","og_type":"article","og_title":"MySQL Collation - Setting Character Sets and Collations in MySQL","og_description":"You will learn about MySQL collation and how to set character sets and collations for the server, database, table, and column.","og_url":"https:\/\/www.mysqltutorial.org\/mysql-collation\/","og_site_name":"MySQL Tutorial","article_modified_time":"2023-10-23T09:53:42+00:00","og_image":[{"url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/mysql-character-sets.png","type":"","width":"","height":""}],"twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/mysql-collation\/","url":"https:\/\/www.mysqltutorial.org\/mysql-collation\/","name":"MySQL Collation - Setting Character Sets and Collations in MySQL","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-collation\/#primaryimage"},"image":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-collation\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/mysql-character-sets.png","datePublished":"2013-05-14T08:46:50+00:00","dateModified":"2023-10-23T09:53:42+00:00","description":"You will learn about MySQL collation and how to set character sets and collations for the server, database, table, and column.","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-collation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/mysql-collation\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mysqltutorial.org\/mysql-collation\/#primaryimage","url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/mysql-character-sets.png","contentUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/mysql-character-sets.png","width":414,"height":308,"caption":"mysql character sets"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/mysql-collation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mysqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"MySQL Basics","item":"https:\/\/www.mysqltutorial.org\/mysql-basics\/"},{"@type":"ListItem","position":3,"name":"MySQL Collation"}]},{"@type":"WebSite","@id":"https:\/\/www.mysqltutorial.org\/#website","url":"https:\/\/www.mysqltutorial.org\/","name":"MySQL Tutorial","description":"A comprehensive MySQL Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mysqltutorial.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/2342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/comments?post=2342"}],"version-history":[{"count":4,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/2342\/revisions"}],"predecessor-version":[{"id":11587,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/2342\/revisions\/11587"}],"up":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/174"}],"wp:attachment":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media?parent=2342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}