2

I have a wierd case. Suddenly some records (so many records) in one of the table are missing.. first, I tought it is caused by bug in my PHP script. But, I checked it, there's no DELETE operation in my script, only UPDATE. Does anyone knows what happen with my MySql?

kv0
  • 914
  • 10
  • 14
  • Perhaps table crashed. Try to repair it: http://dev.mysql.com/doc/refman/5.1/en/repair-table.html – Vitaly Dyatlov Jun 19 '12 at 08:42
  • Is that a wordpress site?? or plain php website? – Dilip Rajkumar Jun 19 '12 at 08:43
  • Or undeploy your web application and check.. to know whether the problem is in your code or someware else.. – Dilip Rajkumar Jun 19 '12 at 08:45
  • Thanks for the info I'll try it. But I still confuse.. it is only affect one of my table and all the data is gone except last inserted data. In this table i had data from 2010 until 2012. Suddenly, all the data is gone except data that inserted in June 2012 – Haryo Bergas Jun 19 '12 at 08:47
  • It is plain php website. The script just for insert and update operation. No delete operation.. – Haryo Bergas Jun 19 '12 at 08:48
  • I think because of auto increment id. visit https://stackoverflow.com/questions/18692068/will-mysql-reuse-deleted-ids-when-auto-increment-is-applied – Wai Gyi Mar 19 '20 at 15:10

3 Answers3

2

I too think Some one might have executed SQL Injection by deleting rows or dropping tables

Rish
  • 447
  • 7
  • 24
1

Maybe you or someone who have access, restored database from dump?

Laser
  • 6,652
  • 8
  • 54
  • 85
1

See here: http://owasp.com/index.php/SQL_Injection

Some stuff to check: If you use something like phpMyAdmin, make sure nobody can access it from outside.

If you use stored procedures verify them as well, some might delete. External applications might delete stuff from your database so strictly control who has privileges.

Also you can make sure you log all your operations and you can keep backups using the mysqldump command that you can compare daily: http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html

Mihai

mihaisimi
  • 1,911
  • 13
  • 15