MilesWeb Hosting Forum

Web Hosting Technical Support => Errors and Solutions => Topic started by: Dipak Bhoi on December 24, 2013, 08:01:00 AM

Title: Mysql - Can't find file: (errno: 13)
Post by: Dipak Bhoi on December 24, 2013, 08:01:00 AM
Hello guys,

When opening my site showing following error :

Quote
Can't find file: './your_database_name/myfile_session.frm' (errno: 13) SQL=INSERT INTO `myfile_session` (`session_id`, `client_id`, `time`) VALUES ('adadasdasdasdzc3423sdfs', 0, '2334234234')

This error is occurring due to sometimes there is a permission problem for file.
Login into server via ssh and get root access. Go to mysql directory (/var/lib/mysql/).
Quote
#cd /var/lib/mysql/
Check permission of your_databse_file_name  it has 700 permission and the files under this directory has 660 permission.
The directory and files have the same owner and group (mysql:mysql).

Quote
#ll
drwx------. 2 mysql mysql  4096 Apr  9  2012 your_databse_file_name
Quote
#ll your_databse_file_name

-rw-rw----. 1 mysql mysql   112 Apr  9  2012 stm_users.MYD
-rw-rw----. 1 mysql mysql 15360 Apr  9  2012 stm_users.MYI
-rw-rw----. 1 mysql mysql  8663 Apr  9  2012 stm_user_usergroup_map.frm
-rw-rw----. 1 mysql mysql     9 Apr  9  2012 stm_user_usergroup_map.MYD
-rw-rw----. 1 mysql mysql  2048 Apr  9  2012 stm_user_usergroup_map.MYI
-rw-rw----. 1 mysql mysql 25081 Apr  9  2012 stm_viewlevels.frm
-rw-rw----. 1 mysql mysql    80 Apr  9  2012 stm_viewlevels.MYD
Follow are the command how to change ownership and permission of files.
To change ownership.
Quote
#chown mysql:mysql /var/lib/mysql/your_databse_file_name -R
&
To change permission of files :
Quote
#chmod 700 /var/lib/mysql/your_databse_file_name
and
#chmod 660 /var/lib/mysql/your_databse_file_name/ -R