The error "ERROR 1018 (HY000): Can't read dir of './dbname/' (errno: 13)" typically occurs when MySQL is unable to access the directory that contains the data files for a database. This error can be caused by a number of factors, including incorrect permissions on the directory, a missing or corrupt data file, or an issue with the MySQL server.
To troubleshoot this error, you can try the following steps:
ls -l
command to view the permissions on the directory:ls -l /path/to/dbname
Make sure that the MySQL server has read and execute permissions on the directory. If the permissions are incorrect, you can use the chmod
command to fix them:
chmod 755 /path/to/dbname
Check the data files. Make sure that all of the data files for the database are present in the directory and are not corrupt. If a data file is missing or corrupt, it may cause this error.
Restart the MySQL server. If the error persists after checking the permissions and data files, you may need to restart the MySQL server to resolve the issue. You can use the service mysql restart
command to restart the MySQL server on most systems.
Check the MySQL error log. The MySQL error log may contain more information about the cause of the error. You can check the MySQL error log by looking in the /var/log/mysql/
directory.
If these steps do not help resolve the error, you may need to seek further assistance from your MySQL administrator or support team.