Mysql“select * from”不返回所有行

时间:2022-09-22 15:59:10

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

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

This table (from SugarCRM) has 3057 rows:

该表(来自SugarCRM)有3057行:

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

But when running SELECT * FROM tasks :

但是在运行SELECT * FROM tasks时:

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

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,但问题是我只是试图转储数据库并恢复到新版本。

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

Do you have any ideas?

你有什么想法?

1 个解决方案

#1


3  

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.

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

Before repairing it is recommended that you backup. To repair

在修复之前,建议您备份。修理

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

#1


3  

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.

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

Before repairing it is recommended that you backup. To repair

在修复之前,建议您备份。修理

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