HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How to Recover truncate table in MySQL?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
recovertruncatemysqlhowtable

Problem

I am getting the "wrong input table name" when use TRUNCATE as following:

TRUNCATE `stats`


The table should bans.

How to recover stats table?

I am using CentOS 6, and MySQL-Server.

Solution

Truncate Operation Drops the existing table and recreates it .its a fast process . so we cannot get the deleted records.

Solution to this issue is to do a regular backup of the DB on a a daily or weekly basis , in order to save or restore the tables data as per requirement . and reuse it

Another solution is to export the table data before truncate and keep the data for Future reference

Context

StackExchange Database Administrators Q#60722, answer score: 5

Revisions (0)

No revisions yet.