Mysql“select * from"不返回所有行 [英] Mysql "select * from" doesn't return all rows

查看:59
本文介绍了Mysql“select * from"不返回所有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经习惯了 PostgreSQL 并且不理解 MySQL 上的这种行为.

I'm used to PostgreSQL and don't understand this behaviour on MySQL.

此表(来自 SugarCRM)有 3057 行:

This table (from SugarCRM) has 3057 rows:

mysql> SELECT  count(*) FROM tasks ;
+----------+
| count(*) |
+----------+
|     3057 |
+----------+

但是在运行 SELECT * FROM tasks 时:

mysql> SELECT * FROM tasks ;
...
2344 rows in set (0,02 sec)

我使用的是相当旧版本的 MySQL,但问题是我只是想转储数据库并恢复到新版本.

I'm using a fairly old version of MySQL, but the issue is I'm just trying to dump the database and restore to a new version.

# mysql --version
mysql  Ver 14.14 Distrib 5.1.51, for slackware-linux-gnu (x86_64) using  EditLine wrapper

你有什么想法吗?

推荐答案

通常 MyISAM 表格式非常可靠,但有时表会因各种原因而损坏,例如硬件故障、mysqld 进程在写操作进行时被终止、不合时宜的关闭或 MySQL 或 MyISAM 代码中的错误.如果您使用的是非常旧的版本,则可能存在错误.

Generally MyISAM table format is very reliable but tables can sometime get corrupted for various reasons like Hardware failures, mysqld process is killed while a write operation is underway, untimely shutdowns or bugs in the MySQL or MyISAM code. If you're using a very old version then bugs are likely.

修复前建议备份.修复

REPAIR [NO_WRITE_TO_BINLOG | LOCAL] TABLE
tbl_name [, tbl_name] ...
[QUICK] [EXTENDED] [USE_FRM]

这篇关于Mysql“select * from"不返回所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆