如题。mysql用TRUNCATE来删除表数据,表中原来有84条记录,TRUNCATE却返回只影响了83条。这是为什么呢?

解决方案 »

  1.   

    没遇到过。
    你确认表中原来是 84 条?如果你myisam 表损坏或异常时 select count(*) 的结果并不准确。check table 
    repaire table 
      

  2.   

    继续truncate看能不能删除select cont(*) from tb;
      

  3.   

    mysql> select * from t;
    +----+---------+-------+
    | id | name    | value |
    +----+---------+-------+
    |  1 | Math    |    92 |
    |  2 | History |    45 |
    |  3 | Scient  |    99 |
    +----+---------+-------+
    3 rows in set (0.23 sec)mysql> truncate table t;
    Query OK, 0 rows affected (0.13 sec)mysql> select * from t;
    Empty set (0.00 sec)
    正常是都能删掉的
    贴出你的表结构数据 看看
      

  4.   

    表与索引没有问题吧?
    如果是MYISAM的,repaire table tt;试试
      

  5.   

    那就analyze table xxxx 一下。
      

  6.   

    应该不可能啊,如果真是的话,那就奇怪了试下:analyze table tb_name;optimize table tb_name;
      

  7.   

    在mysql中用TRUNCATE table 表名  可以删除表中的记录,用查询语句select * from 表名 运行一下表中就是空的了,直接点表查看表中却还存在一条记录,不过刷新一下数据库,在点表查,这时候表就空了。
    不知道你用的是什么数据库。