Monday 28 October 2013

Recover error : 1005 Can't create table 'tmp_db' (errno: 13)

While Altering table or changing Storage Engine of Database we may be got this error.
It happens probably due to Permission denied by MySQL.

less /etc/group
and then less /etc/passwd
find mysql user and group name, probably both are named mysql

change to mysql dir, probably var/lib/mysql and then type cd .. to go a dir under.

chown -R mysql:mysql ./mysql/

And also change permission of /tmp file 


By default the temporary file are directed to /tmp partition.
The permission in /tmp is different.

$ ls -ltrh /tmp
drwxr-xr-x  4 root root      4096 Jan 24 04:02 tmp


The group has no write permission on /tmp folder.

Fix :

Changed the permission of the /tmp folder and made the installation again

chmod 777 /tmp/

$ ls -ltrh /tmp

drwxrwxrwx  4 root root      4096 Jan 24 04:02 tmp


Recover Table Crash in Mysql (MYISAM ENGINE) (Got error 134 from storage engine)

Some time you can't repair table using repair command.It will show error like  "Can’t create new tempfile: ‘*.TMD file" .So we have to recover that table particular table or all tables of database.

For that you have to use the following command to do:

First go to the library file path of Mysql


/var/lib/mysql/Particular_db_name:

1.For single table recover

            myisamchk -r -f  TABLENAME.MYI
2.For ALL table recove

            myisamchk -r -f  *.MYI





Repair Table in Mysql

You will get error like Db_Name.Table_Name marked as crashed  while exporting dump to Mysql.
For that you have to manually repair table use of following command

REPAIR TABLE TABLE_NAME