ALTER TABLE tbl DROP COLUMN col_name;
mysql> SELECT * FROM test;
+------+--------+-------+------------+------------+------------+------------+
| t_id | t_name | t_password | t_birth | birth | birth1 | birth2 |
+------+--------+-------+------------+------------+------------+------------+
| 1 | name1 | ... | NULL | 1990-01-01 | 0000-00-00 | 2013-01-01 |
| 2 | name2 | ... | 2013-01-01 | NULL | 0000-00-00 | 2013-01-01 |
+------+--------+-------+------------+------------+------------+------------+
mysql> ALTER TABLE test DROP COLUMN birth1;
Query OK, 0 rows affected (0.13 sec)
mysql> SELECT * FROM test;
+------+--------+-------+------------+------------+------------+
| t_id | t_name | t_password | t_birth | birth | birth2 |
+------+--------+-------+------------+------------+------------+
| 1 | name1 | ... | NULL | 1990-01-01 | 2013-01-01 |
| 2 | name2 | ... | 2013-01-01 | NULL | 2013-01-01 |
+------+--------+-------+------------+------------+------------+
birth1 字段已移除,其餘數據完好。
pt-online-schema-change 在線變更