myisamchk: Argument list too long

When repairing a large database, i got following error

[root@server root]# myisamchk --silent --force --fast --update-state \
          --key_buffer_size=64M --sort_buffer_size=64M \
          --read_buffer_size=1M --write_buffer_size=1M /var/lib/mysql/databasename/*.MYI
-bash: /usr/bin/myisamchk: Argument list too long

To fix the error, run

SOLUTION 1

find /backup/mysql/bizhat_s2 -type f -print0 -name '*.MYI' | xargs -0 myisamchk --force --fast --update-state --key_buffer_size=64M --sort_buffer_size=64M --read_buffer_size=1M --write_buffer_size=1M

SOLUTION 2

find /var/lib/mysql/databasename -name *.MYI -exec myisamchk -r {} \;
Advertisement
Add a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement