Results 1 to 3 of 3
  1. #1

    Question Repairing an entire MySQL database

    I'd like to repair an entire database from SSH. I can get in to mysql and enter commands fine, but all I know how to do is

    REPAIR TABLE tablename;

    I've tried inserting a wildcard (* or %) for tablename, but it doesn't work.

    The reason I want to do this that there is more than one table that needs to be repaired, and I don't want to manually type and repair each one.

    myisamchk doesn't seem to work either:

    [[email protected] root]# myisamchk -r /var/lib/mysql/db2/*
    -bash: /usr/bin/myisamchk: Argument list too long

    Anyone have any ideas or workarounds?
    Adventures in - Are you a parent? Listen to the free podcast and sign up for the newsletter!

  2. #2
    Since myisamchk only looks at .MYI files anyhow, you might try this:

    myisamchk -r /var/lib/mysql/db2/*.MYI

    If that still doesn't work, try calling myisamchk on each individual file:

    find /var/lib/mysql/db2 -name *.MYI -exec myisamchk -r {} \;

  3. #3
    Join Date
    Jul 2003
    Make sure you shut down the server first before your run myisamchk, otherwise, tables that you are trying to repair may be open and myisamchk will return errors for those tables.
    In order to understand recursion, one must first understand recursion.
    If you feel like it, you can read my blog
    Signal > Noise

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts