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

后端 未结 9 1495
温柔的废话
温柔的废话 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:55

    I have a solution to a problem that may also apply to you. My database was in a state where a DROP TABLE failed because it couldn't find the table... but a CREATE TABLE also failed because MySQL thought the table existed. (This state could easily mess with your IF NOT EXISTS clause).

    I eventually found this solution:

    sudo mysqladmin flush-tables
    

    For me, without the sudo, I got the following error:

    mysqladmin: refresh failed; error: 'Access denied; you need the RELOAD privilege for this operation'
    

    (Running on OS X 10.6)

提交回复
热议问题