title: Why does alter table set blank values to new not null varchar columns without default value specification?
body: <p>I have the following MySQL table:</p>
  
  <pre><code>| customers | CREATE TABLE `customers` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
    PRIMARY KEY (`id`)
   ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8  
   COLLATE=utf8_unicode_ci |
  </code></pre>
  
  <p>The table already has two rows:</p>
  
  <pre><code>+----+-----------+
  | id | name      |
  +----+-----------+
  |  1 | John Woo  |
  |  3 | Maria Loo |
  +----+-----------+
  2 rows in set (0.00 sec)
  </code></pre>
  
  <p>I am trying to alter the table with the following statement:</p>
  
  <pre><code>alter table customers add column (identity varchar(32) not null);
  </code></pre>
  
  <p>I would expect this statement to fail, due to the fact that I do not specify a default value and the table already has some rows. But it does not. Instead, it adds the column and sets <code>''</code> as value for that new
  column to all existing rows.</p>
  
  <pre><code>+----+-----------+----------+
  | id | name      | identity |
  +----+-----------+----------+
  |  1 | John Woo  |          |
  |  3 | Maria Loo |          |
  +----+-----------+----------+
  2 rows in set (0.00 sec)
  </code></pre>
  
  <p>Is there a way I can make MySQL behave as I expect? I think there is something that one can set at MySQL server configuration variables. But I am not sure.</p>
  
  <p>Any help?</p>
  
  <p><strong>Update</strong> Note that strict mode is already ON:</p>
  
  <pre><code>mysql&gt; show variables where variable_name like '%mode%';
  +--------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  | Variable_name            | Value                                                                                                                                         |
  +--------------------------+----------------------------------------------------------------------------------------------------------------------    ---------------------+
  | block_encryption_mode    | aes-128-ecb                                                                                                                                  |
  | gtid_mode                | OFF                                                                                                                                       |
  | innodb_autoinc_lock_mode | 1                                                                                                                                         |
  | innodb_strict_mode       | ON                                                                                                                                        |
  | offline_mode             | OFF                                                                                                                                       |
  | pseudo_slave_mode        | OFF                                                                                                                                       |
  | rbr_exec_mode            | STRICT                                                                                                                                    |
  | slave_exec_mode          | STRICT                                                                                                                                    |
  | sql_mode                 | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
  +--------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  9 rows in set (0.00 sec)
  </code></pre>