mysql desc:ERROR 1 (HY000): Can't create/write to fi

來源:互聯網
上載者:User

在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]# lltotal 80drwxr-xr-x  2 root  root  4096 Aug 21 17:53 bindrwxr-xr-x  7 mysql mysql 4096 Sep 11 19:43 datadrwxr-xr-x  2 root  root  4096 Aug 21 17:31 docsdrwxr-xr-x  3 root  root  4096 Aug 21 17:31 includedrwxr-xr-x  3 root  root  4096 Aug 21 17:31 libdrwxr-xr-x  2 root  root  4096 Aug 21 17:46 libexecdrwxr-xr-x 10 root  root  4096 Aug 21 17:46 mysql-testdrwxr-xr-x  5 root  root  4096 Aug 21 17:46 sharedrwxr-xr-x  5 root  root  4096 Aug 21 17:46 sql-benchdrwxr-xr-x  2 mysql root  4096 Sep 11 19:43 tmp

好吧,我們的tmp在這裡,那麼我們要到我們的設定檔中看一下

[mysqld]port            = 3306socket          = /usr/local/mysql/tmp/mysql.sockskip-lockingkey_buffer_size = 16Kmax_allowed_packet = 1Mtable_open_cache = 4sort_buffer_size = 64Kread_buffer_size = 256Kread_rnd_buffer_size = 256Knet_buffer_length = 2Kthread_stack = 128K

哦?沒有指定tmpdir的路徑,好吧,在這裡添加一行如下內容

tmpdir=/usr/local/mysql/tmp

然後儲存,退出~

接下來重啟mysql,再進入mysql,問題已經解決。

本文出自 “風之別鶴” 部落格,請務必保留此出處http://addam.blog.51cto.com/5041993/1297810

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.