mysql error : Can’t create/write to file ‘/tmp/#sql_1581_0.MYI’ (Errcode: 13)

Recent PHP downgrade to 5.2.10 also bring another problem with phpmyadmin. When I try to browse data it work but when I try to see table structure I have this error :

Can’t create/write to file ‘/tmp/#sql_1581_0.MYI’ (Errcode: 13)

Being curios if the problem caused by phpmyadmin I try shell way :

# mysql -uroot -p

Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 106
Server version: 5.1.41-3ubuntu12.8 (Ubuntu)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> desc user;
ERROR 1 (HY000): Can’t create/write to file ‘/tmp/#sql_1581_0.MYI’ (Errcode: 13)
mysql>

Ups, seem same problem.

Looking log data

# tail -f /var/log/mysql/error.log

101217  0:10:02 [Note] /usr/sbin/mysqld: Shutdown complete

101217  0:10:02 [Note] Plugin ‘FEDERATED’ is disabled.
/usr/sbin/mysqld: Can’t create/write to file ‘/tmp/ibLwkhPZ’ (Errcode: 13)
101217  0:10:02  InnoDB: Error: unable to create temporary file; errno: 13
101217  0:10:02 [ERROR] Plugin ‘InnoDB’ init function returned error.
101217  0:10:02 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
101217  0:10:02 [Note] Event Scheduler: Loaded 0 events
101217  0:10:02 [Note] /usr/sbin/mysqld: ready for connections.
Version: ‘5.1.41-3ubuntu12.8’  socket: ‘/var/run/mysqld/mysqld.sock’  port: 3306  (Ubuntu)

I guess its permission problem and quick solution for the problem.

# ls -l / | grep tmp

drwxr-xr-x   4 root root  4096 2010-12-17 00:10 tmp
#

# chmod 777 /tmp

Recheck with shell

# mysql -uroot -p

Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 112
Server version: 5.1.41-3ubuntu12.8 (Ubuntu)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> desc user;
+———————–+———————————–+——+—–+———+——-+
| Field                 | Type                              | Null | Key | Default | Extra |
+———————–+———————————–+——+—–+———+——-+
| Host                  | char(60)                          | NO   | PRI |         |       |
| User                  | char(16)                          | NO   | PRI |         |       |
| Password              | char(41)                          | NO   |     |         |       |
| Select_priv           | enum(‘N’,’Y’)                     | NO   |     | N       |       |
| Insert_priv           | enum(‘N’,’Y’)                     | NO   |     | N       |       |
| Update_priv           | enum(‘N’,’Y’)

more …………

great.

Tags: