title: MySQL AES_ENCRYPT all values for a column
body: <p>Lets assume I have a table with 10,000 rows. What is the fastest way to encrypt every value for a specific column with AES_ENCRYPT using the same AES password/salt? </p>
  
  <p><strong>I actually will have to do this across many tables and many columns, so I am trying to find a quick way to do this.</strong></p>
  
  <p>Assuming that I have changed the type to the city_name column below to BLOB already, is there someway I could import the data back into mysql using a query like this (I am just showing the first 10 inserts, but this table could have 10,000+ of rows):</p>
  
  <pre><code>INSERT INTO `cities` (`id`, AES_ENCRYPT(`city_name` `password`), `state_id`, `country_id`) 
  VALUES
  (1, 'Feyzabad', 15, 1),
  (2, 'Baghlan', 17, 1),
  (3, 'Nahrin', 17, 1),
  (4, 'Pol-e Khomri', 17, 1),
  (5, 'Cool urhajo', 18, 1),
  (6, 'Farakh', 19, 1),
  (7, 'Andkhvoy', 20, 1),
  (8, 'Ghazni', 21, 1),
  (9, 'Shahrag', 22, 1),
  (10, 'Gereshk', 23, 1);
  </code></pre>