content_image/851546.jpg content_image/851553.jpg
## B.3.2.17 Table-Corruption Issues 

<img src='content_image/851546.jpg'>

## Note 

If you run the tcsh  shell, ulimit  does not work! tcsh  also reports incorrect values when you ask for the current limits. In this case, you should start mysqld_safe  using sh . 

If you have started mysqld  with the myisam_recover_options  system variable set, MySQL automatically checks and tries to repair MyISAM  tables if they are marked as ’not closed properly’ or ’crashed’. If this happens, MySQL writes an entry in the hostname.err  file ’Warning: Checking table ...’  which is followed by Warning: Repairing table  if the table needs to be repaired. If you get a lot of these errors, without mysqld  having died unexpectedly just before, then something is wrong and needs to be investigated further. 

When the server detects MyISAM  table corruption, it writes additional information to the error log, such as the name and line number of the source file, and the list of threads accessing the table. Example: Got an error from thread_id=1, mi_dynrec.c:368 . This is useful information to include in bug reports. 

See also Section 5.1.7, “Server Command Options” , and Section 5.9.1.7, “Making a Test Case If You Experience Table Corruption” . 

## B.3.3 Administration-Related Issues 

## B.3.3.1 Problems with File Permissions 

If you have problems with file permissions, the UMASK  or UMASK_DIR  environment variable might be set incorrectly when mysqld  starts. For example, mysqld  might issue the following error message when you create a table: 

ERROR: Can’t find file: ’path/with/ file_name ’ (Errcode: 13) 

The default UMASK  and UMASK_DIR  values are 0640  and 0750 , respectively. mysqld  assumes that the value for UMASK  or UMASK_DIR  is in octal if it starts with a zero. For example, setting UMASK=0600  is equivalent to UMASK=384  because 0600 octal is 384 decimal. 

Assuming that you start mysqld  using mysqld_safe , change the default UMASK  value as follows: 

UMASK=384 # = 600 in octal export UMASK mysqld_safe & 

<img src='content_image/851553.jpg'>

## Note 

An exception applies for the error log file if you start mysqld  using mysqld_safe , which does not respect UMASK : mysqld_safe  may create the error log file if it does not exist prior to starting mysqld , and mysqld_safe  uses a umask set to a strict value of 0137 . If this is unsuitable, create the error file manually with the desired access mode prior to executing mysqld_safe . 

By default, mysqld  creates database directories with an access permission value of 0750 . To modify this behavior, set the UMASK_DIR  variable. If you set its value, new directories are created with the combined UMASK  and UMASK_DIR  values. For example, to give group access to all new directories, start mysqld_safe  as follows: 

UMASK_DIR=504 # = 770 in octal export UMASK_DIR mysqld_safe & 

