# Last\_SQL\_Errno: 1146

**URL:** <https://forums.percona.com/t/last-sql-errno-1146/23675>\
**Category:** Uncategorized\
**Created:** [July 16, 2023, 8:16pm UTC](https://forums.percona.com/t/last-sql-errno-1146/23675 "2023-07-16T20:16:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![parttime](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@parttime](https://forums.percona.com/u/parttime)\
**Post date:** [July 16, 2023, 8:16pm UTC](https://forums.percona.com/t/last-sql-errno-1146/23675/1 "2023-07-16T20:16:22Z")

</div>

hi,  
I set up the replication. my.cnf is the same(master-slave). but when I say show slave, I see that I get an error.  
Last\_SQL\_Errno: 1146  
Last\_SQL\_Error: Error executing row event: ‘Table ‘table.tablename’ doesn’t exist’

I’m backing up with xtrabackup. I can restore.  
Why does it give this error?

slave restore log:

230716 23:06:27 [01] Copying ./xtrabackup\_info to /data/mysql/mysql/xtrabackup\_info  
230716 23:06:27 [01] …done  
230716 23:06:27 completed OK!

---

<div class="post-metadata">

**Author:** ![Mauricio\_Cacho](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/mauricio_cacho/32/5859_2.png) [@Mauricio\_Cacho](https://forums.percona.com/u/Mauricio_Cacho)\
**Post date:** [July 17, 2023, 12:00am UTC](https://forums.percona.com/t/last-sql-errno-1146/23675/2 "2023-07-17T00:00:46Z")

</div>

Hi @parttime.

As the error states, your issue is when replica is trying to work on a table that doesn’t exists in your replica:

```auto
Last_SQL_Errno: 1146
Last_SQL_Error: Error executing row event: ‘Table ‘table.tablename’ doesn’t exist’

```

This means your data is not consistent between your primary and your replica, thus something that was successfully executed on the primary, fails when it’s trying to execute on the replica.

If I understood correctly, you’ve restored recently from the XtraBackup? If so, could you share how you restored the data and how you configured the replication?

If you can rebuild your replica it may be better than trying to fix this; since this error basically means the data in between your primary and your replica is not consistent. Here’s a [simple tutorial](https://docs.percona.com/percona-xtrabackup/8.0/howtos/setting_up_replication.html) on how to achieve this using Percona XtraBackup, take a look and I hope this helps you.

Best,  
Mauricio.

---

<div class="post-metadata">

**Author:** ![parttime](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@parttime](https://forums.percona.com/u/parttime)\
**Post date:** [July 17, 2023, 5:48am UTC](https://forums.percona.com/t/last-sql-errno-1146/23675/3 "2023-07-17T05:48:11Z")

</div>

> [@Mauricio\_Cacho](#):
>
> If you can rebuild your replica it may be better than trying to fix this; since this error basically means the data in between your primary and your replica is not consistent. Here’s a [simple tutorial](https://docs.percona.com/percona-xtrabackup/8.0/howtos/setting_up_replication.html) on how to achieve this using Percona XtraBackup, take a look and I hope this helps you.

yes, ı did. script is as below.

$ innobackupex --copy-back /data/mysql/script  
230716 14:22:22 completed OK!

I get backup with xtrabackup, I did restore as in the script. However i am getting the error.

---

<div class="post-metadata">

**Author:** ![lalit.choudhary](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lalit.choudhary/32/51_2.png) [@lalit.choudhary](https://forums.percona.com/u/lalit.choudhary)\
**Post date:** [July 17, 2023, 6:44am UTC](https://forums.percona.com/t/last-sql-errno-1146/23675/4 "2023-07-17T06:44:27Z")

</div>

Hello @parttime

Please ensure you are using `xtrabackup_binlog_info` file binlog pos/ GTID details to set up a replica.

Ref:

> **[Percona XtraBackup - How to setup a replica for replication in 6 simple steps...](https://docs.percona.com/percona-xtrabackup/2.4/howtos/setting_up_replication.html#step-4-configure-the-replica-mysql-server)**
>
> Data is, by far, the most valuable part of a system. Having a backup done
> systematically and available for a rapid recovery in case of failure is
> admittedly essential to a system. However, it is not common practice because of
> its costs,...

For GTID replication: [How to create a new (or repair a broken) GTID based slave - Percona XtraBackup](https://docs.percona.com/percona-xtrabackup/2.4/howtos/recipes_ibkx_gtid.html)

PS/MySQL-8.0:

> **[Percona XtraBackup - How to set up a replica for replication in 6 simple...](https://docs.percona.com/percona-xtrabackup/8.0/set-up-replication.html)**
>
> Data is, by far, the most valuable part of a system. Having a backup done
> systematically and available for a rapid recovery in case of failure is
> admittedly essential to a system. However, it is not common practice
> because of
> its costs,...

For GTID replication: [How to create a new (or repair a broken) GTID-based replica - Percona XtraBackup](https://docs.percona.com/percona-xtrabackup/8.0/create-gtid-replica.html)
