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 {} \;
See MySQL