# Pt-table-checksum

**URL:** <https://forums.percona.com/t/pt-table-checksum/17146>\
**Category:** MySQL & MariaDB\
**Created:** [August 24, 2022, 2:29pm UTC](https://forums.percona.com/t/pt-table-checksum/17146 "2022-08-24T14:29:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dba1](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/dba1/32/24223_2.png) [@Dba1](https://forums.percona.com/u/Dba1)\
**Post date:** [August 24, 2022, 2:29pm UTC](https://forums.percona.com/t/pt-table-checksum/17146/1 "2022-08-24T14:29:58Z")

</div>

Can someone help out with this tool? I would like to use this tool to find out the discrepancies in my two databases. Well they are in master to slave replication I believe the Slave has some data the master doesn’t have. Any other ways to figure out this discrepancies? NOTE This is a big database about 1TB EACH.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [August 24, 2022, 2:45pm UTC](https://forums.percona.com/t/pt-table-checksum/17146/2 "2022-08-24T14:45:26Z")

</div>

Run `pt-table-checksum` on the source/master. You can use `-d` and `-t` to limit to specific databases and tables if you like. After the script is done, go to your replicas and run this SQL: `SELECT db, tbl FROM percona.checksums WHERE this_crc != master_crc` and that will show you which tables are different.

Then you need to run `pt-table-sync --execute --sync-to-master --replicate percona.checksums h=localhost` on your replicas with differences. This will cause pt-table-sync to run any SQL needed to add or delete data from the replica to match the source.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [August 24, 2022, 2:47pm UTC](https://forums.percona.com/t/pt-table-checksum/17146/3 "2022-08-24T14:47:34Z")

</div>

pt-table-sync will make the replica match the source. If there is extra data on the replica that is not on the source, it will be removed from the replica. If there is extra data on the source that is not on the replica, it will be added to the replica.

---

<div class="post-metadata">

**Author:** ![Dba1](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/dba1/32/24223_2.png) [@Dba1](https://forums.percona.com/u/Dba1)\
**Post date:** [August 24, 2022, 2:50pm UTC](https://forums.percona.com/t/pt-table-checksum/17146/4 "2022-08-24T14:50:59Z")

</div>

Thanks a lot! Do I need to create checksum user at all ? This is the confusion. According to the documentation by percona. I haven’t seen any but there is a blog written by “Irfan” on this tool in his demonstrations he created a user. If it’s not needed for this tool to work I’ll just move on

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [August 24, 2022, 2:54pm UTC](https://forums.percona.com/t/pt-table-checksum/17146/5 "2022-08-24T14:54:53Z")

</div>

You can use any user with read/write privileges to the tables you are checksumming and also grant privileges to the `percona` database to store the checksum data. You can use a different database/table for the checksum data if you like by adding `--replicate mydatabase.mychecksums` to both tools.

---

<div class="post-metadata">

**Author:** ![Dba1](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/dba1/32/24223_2.png) [@Dba1](https://forums.percona.com/u/Dba1)\
**Post date:** [August 24, 2022, 3:19pm UTC](https://forums.percona.com/t/pt-table-checksum/17146/6 "2022-08-24T15:19:39Z")

</div>

After running pt-table-checksums on master it gave me a message like” my slave has binlog\_format ROW which could break replication. Anyways it created a percona database in the Slave still. I used the query you mentioned and it gave me an empty set. Does it mean no discrepancies or in doing something wrong

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [August 24, 2022, 4:34pm UTC](https://forums.percona.com/t/pt-table-checksum/17146/7 "2022-08-24T16:34:38Z")

</div>

Is there any data on the replica inside that table? If not, then the checksum process did not finish. You can safely use `--no-check-binlog-format` to remove that warning as long as your replica does not also have a replica.
