MySQL “CREATE TABLE IF NOT EXISTS” -> Error 1050

后端 未结 9 1500
温柔的废话
温柔的废话 2021-02-01 00:16

Using the command:

CREATE TABLE IF NOT EXISTS `test`.`t1` (
    `col` VARCHAR(16) NOT NULL
) ENGINE=MEMORY;

Running this twice in the MySQL Que

9条回答
  •  遥遥无期
    2021-02-01 00:59

    As already stated, it's a warning not an error, but (if like me) you want things to run without warnings, you can disable that warning, then re-enable it again when you're done.

    SET sql_notes = 0;      -- Temporarily disable the "Table already exists" warning
    CREATE TABLE IF NOT EXISTS ...
    SET sql_notes = 1;      -- And then re-enable the warning again
    

提交回复
热议问题