mysql desc:ERROR 1 (HY000): Can't create/write to file '/tmp/#sql_1737_0.MYI' (Errcode: 13)

在mysql使用过程中,当我想要使用desc来查看表结构的时候,去提示报错信息,具体报错信息如下

ERROR 1 (HY000): Can't create/write to file '/tmp/#sql_1737_0.MYI' (Errcode: 13)

没遇见过,网上大概搜了一下,这个问题出现的几率还是很高啊,哈哈!!解决方法

找到mysql的安装目录,注意:如果你是编译安装的,那么到你编译安装的mysql目录下面哦,如果是yum安装的,请到默认的安装目录下,我这里使用编译安装的。

[root@DB tmp]# cd /usr/local/mysql/
[root@DB mysql]# ll
total 80
drwxr-xr-x  2 root  root  4096 Aug 21 17:53 bin
drwxr-xr-x  7 mysql mysql 4096 Sep 11 19:43 data
drwxr-xr-x  2 root  root  4096 Aug 21 17:31 docs
drwxr-xr-x  3 root  root  4096 Aug 21 17:31 include
drwxr-xr-x  3 root  root  4096 Aug 21 17:31 lib
drwxr-xr-x  2 root  root  4096 Aug 21 17:46 libexec
drwxr-xr-x 10 root  root  4096 Aug 21 17:46 mysql-test
drwxr-xr-x  5 root  root  4096 Aug 21 17:46 share
drwxr-xr-x  5 root  root  4096 Aug 21 17:46 sql-bench
drwxr-xr-x  2 mysql root  4096 Sep 11 19:43 tmp

好吧,我们的tmp在这里,那么我们要到我们的配置文件中看一下

[mysqld]
port            = 3306
socket          = /usr/local/mysql/tmp/mysql.sock
skip-locking
key_buffer_size = 16K
max_allowed_packet = 1M
table_open_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 128K

哦?没有指定tmpdir的路径,好吧,在这里添加一行如下内容

tmpdir=/usr/local/mysql/tmp

然后保存,退出~

接下来重启mysql,再进入mysql,问题已经解决。

你可能感兴趣的:(mysql,desc)