<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="adding-collation-choosing-id">
      </a>
      12.14.2 Choosing a Collation ID
     </h3>
    </div>
   </div>
  </div>
  <p>
   Each collation must have a unique ID. To add a collation, you
        must choose an ID value that is not currently used. MySQL
        supports two-byte collation IDs. The range of IDs from 1024 to
        2047 is reserved for user-defined collations.
  </p>
  <p>
   The collation ID that you choose appears in these contexts:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      The
      <code class="literal">
       ID
      </code>
      column of the Information Schema
      <a class="link" href="information-schema-collations-table.html" title="28.3.6 The INFORMATION_SCHEMA COLLATIONS Table">
       <code class="literal">
        COLLATIONS
       </code>
      </a>
      table.
     </p>
    </li>
    <li class="listitem">
     <p>
      The
      <code class="literal">
       Id
      </code>
      column of
      <a class="link" href="show-collation.html" title="15.7.7.5 SHOW COLLATION Statement">
       <code class="literal">
        SHOW COLLATION
       </code>
      </a>
      output.
     </p>
    </li>
    <li class="listitem">
     <p>
      The
      <code class="literal">
       charsetnr
      </code>
      member of the
      <code class="literal">
       MYSQL_FIELD
      </code>
      C API data structure.
     </p>
    </li>
    <li class="listitem">
     <p>
      The
      <code class="literal">
       number
      </code>
      member of the
      <code class="literal">
       MY_CHARSET_INFO
      </code>
      data structure returned
            by the
      <a class="ulink" href="/doc/c-api/8.4/en/mysql-get-character-set-info.html" target="_top">
       <code class="literal">
        mysql_get_character_set_info()
       </code>
      </a>
      C API function.
     </p>
    </li>
   </ul>
  </div>
  <p>
   To determine the largest currently used ID, issue the following
        statement:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa5019820"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">MAX</span><span class="token punctuation">(</span>ID<span class="token punctuation">)</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>COLLATIONS<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> MAX(ID) <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span>     247 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
  </div>
  <p>
   To display a list of all currently used IDs, issue this
        statement:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60520187"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> ID <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>COLLATIONS <span class="token keyword">ORDER</span> <span class="token keyword">BY</span> ID<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> ID  <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span>   1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>   2 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  52 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  53 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  57 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  58 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  98 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span>  99 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 128 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 129 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ... <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> 247 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
  </div>
  <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Warning
   </div>
   <p>
    Before upgrading, you should save the configuration files that
          you change. If you upgrade in place, the process replaces the
          modified files.
   </p>
  </div>
 </div>
 <br/>
</div>
