title: Creating MySQL a table with a primary text key
body: <p>The command that I use to <code>CREATE</code> my <code>TABLE</code> is: </p>
  
  <pre><code>CREATE TABLE carts(order_id TEXT(14), items TEXT, shipping INT, price INT
  </code></pre>
  
  <p>I'd like to set 'order_id' as my primary key. I've tried to <code>ALTER</code> the <code>TABLE</code> with:</p>
  
  <pre><code>ALTER TABLE `carts` ADD PRIMARY KEY(order_id)
  </code></pre>
  
  <p>But that returns the error:</p>
  
  <pre><code> #1170 - BLOB/TEXT column 'order_id' used in key specification without a key length
  </code></pre>
  
  <p>I understand that means that the length isn't being set correctly in the initial setup, so I tried:</p>
  
  <pre><code>ALTER TABLE `carts` ADD PRIMARY KEY(order_id(14))
  </code></pre>
  
  <p>Which returns the same error. The type defined in <em>phpmyadmin</em> is 'tinytext'; I was expecting to see <code>TEXT(14)</code>.</p>
  
  <p>I'm performing all of these commands via PDO in PHP. What's the correct way to set the column 'order_id' as my <code>TABLE</code>'s primary key?</p>