1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to repair corrupted mysql table?

Discussion in 'Site & Server Administration' started by postcd, May 2, 2014.

  1. #1
    Hello,

    im having command to check and repair (at least i believe) all mysql tables in all databases:

    but on my website i got error message an table is crashed, so i run above command but it just returned like:

    So i want to ask how i can repair that table using mysqlcheck or any other linux command?

    Its possible to do via phpmyadmin but i need linux command.

    Thx
     
    postcd, May 2, 2014 IP
  2. ryan_uk

    ryan_uk Illustrious Member

    Messages:
    3,983
    Likes Received:
    1,022
    Best Answers:
    33
    Trophy Points:
    465
    #2
    What engine is it using?
     
    ryan_uk, May 2, 2014 IP
  3. Shagoon

    Shagoon Notable Member

    Messages:
    596
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    220
  4. postcd

    postcd Well-Known Member

    Messages:
    1,037
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    190
    #4
    Shagoon: that not help. i already read.
     
    postcd, May 7, 2014 IP
  5. Jason James

    Jason James Peon

    Messages:
    12
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    3
    #5
    Assuming this is MyISAM

    myisamchk -r -v -f --sort_buffer_size=128M --key_buffer_size=128M /path/to/your/base/table.MYI
     
    Jason James, May 7, 2014 IP
  6. ryan_uk

    ryan_uk Illustrious Member

    Messages:
    3,983
    Likes Received:
    1,022
    Best Answers:
    33
    Trophy Points:
    465
    #6
    Assuming. As he didn't answer my question, I assume he doesn't know what is meant by engine. :-D

    I would be tempted to do a -q -r first though. Or just a myisamchk on the database file to get an overview of what is wrong. Do another after the repair too.
     
    ryan_uk, May 7, 2014 IP
  7. postcd

    postcd Well-Known Member

    Messages:
    1,037
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    190
    #7
    Im not sure what is is. This is vbulletin wordpress and similar CMS.

    Im quoting:
    I assume i would need a bash script to repair only crashed tables, because --auto-repair dont works and --repair works but on all tables even not crashed which i dont need.
    But i did not found any bash script that do this. not capable to make it myself, i would spend around 24 hours doing it
     
    postcd, May 8, 2014 IP
  8. ryan_uk

    ryan_uk Illustrious Member

    Messages:
    3,983
    Likes Received:
    1,022
    Best Answers:
    33
    Trophy Points:
    465
    #8
    Regarding engines:
    http://dev.mysql.com/doc/refman/5.0/en/storage-engines.html

    Firstly, before doing anything I would recommend backing up the files, so if it does get screwed you would have backups to fall back to.

    Secondly, figure out what storage engine you're using. Then before even repairing do an analysis to identify what is corrupt and take steps that are more suitable for that particular engine.
     
    ryan_uk, May 8, 2014 IP
  9. hostechsupport

    hostechsupport Well-Known Member

    Messages:
    413
    Likes Received:
    23
    Best Answers:
    7
    Trophy Points:
    138
    #9
    Have you tried this command too : mysqlcheck -u root -p --auto-repair --check --optimize --all-databases ? Please check & comment.
     
    hostechsupport, May 18, 2014 IP
  10. chrisfc61

    chrisfc61 Greenhorn

    Messages:
    22
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    23
    #10
    Hello

    If you have phpmyadmin access you have a repair function integrated.

    Regards
    Christophe
     
    chrisfc61, Jun 8, 2014 IP