Home  >  Q&A  >  body text

mysql表无法添加字段是什么问题啊

添加过一次sql失败了之后,再执行该sql,就报错了,无法添加字段

sql:
ALTER TABLE bms_c.room ADD COLUMN live_id INT(11) DEFAULT '0'

错误信息:
Query : alter table bms_c.room add column live_id int(11) DEFAULT '0'
Error Code : 1050
Table 'bms_c/#sql-ib1551' already exists
Execution Time : 00:00:00:000
Transfer Time : 00:00:00:000
Total Time : 00:00:00:000

PHP中文网PHP中文网2742 days ago937

reply all(2)I'll reply

  • PHPz

    PHPz2017-04-17 11:49:54

    alter table table name add field name int default 0
    //Since it is an int type, why does it default to 0 for the string when you add it?

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 11:49:54

    alter table will create a new empty table, fill it with data, and then delete the original table.
    Judging from your prompt, it may be that the sql execution failed last time, but the temporary table created was retained

    reply
    0
  • Cancelreply