Finding missing records from two tables I am trying to compare total number of records for a particular table in two databases. They are from the same database, but both the database are running in two different servers.

Table structure is same on both the tables , but no of records varies on both the tables.

I want to find out the missing records from both these tables.

mysql&gt; select count(*) from dlfilerank;
+----------+
| count(*) |
+----------+
|    38259 |
+----------+
1 row in set (0.02 sec)


mysql&gt; select count(*) from dlfilerank;
+----------+
| count(*) |
+----------+
|    38359 |
+----------+
1 row in set (0.02 sec)
So, dump both tables into two files and then see the difference with diff:

 mysql -h host1 -NB -e "SELECT * FROM db.table ORDER BY id" &gt; t1
 mysql -h host2 -NB -e "SELECT * FROM db.table ORDER BY id" &gt; t2

 diff -u t1 t2