[SQL ] mysql5.6 修改資料庫路徑 ?

看板Database作者 (降太)時間10年前 (2013/10/08 11:30), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串1/2 (看更多)
因為硬碟空間不夠用了,想把資料移到/home下面 而且希望以後都在那下面運算(運算的時候消耗到/home的空間,/要炸了) 先修改了my.cny,把datadir設 /home/data/mysql socket也改過去 然後把/var/lib/mysql 裡面的資料都複製過去 修改/home/data/mysql的屬性(chown mysql:mysql /home/data) gpasswd mysql root (所以說mysql在新的資料位置是有權限運作的) 最後service mysqld restart 在start的地方 [faile] 回去翻查log檔 131008 00:51:06 mysqld_safe Starting mysqld daemon with databases from /home/data/mysql ----------------- 131008 0:51:06 [Warning] Can't create test file /home/data/mysql/youtube.lower-test 131008 0:51:06 [Warning] Can't create test file /home/data/mysql/youtube.lower-test ^G/usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13) 131008 0:51:06 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. ^G/usr/libexec/mysqld: Can't create/write to file '/home/data/tmp/ibe3iIFH' (Errcode: 13) 131008 0:51:06 InnoDB: Error: unable to create temporary file; errno: 13 131008 0:51:06 [ERROR] Plugin 'InnoDB' init function returned error. 131008 0:51:06 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 131008 0:51:06 [ERROR] Can't start server : Bind on unix socket: Permission denied ------------------ 131008 0:51:06 [ERROR] Do you already have another mysqld server running on socket: /home/data/mysql/mysql.sock ? 131008 0:51:06 [ERROR] Aborting 131008 0:51:06 [Note] /usr/libexec/mysqld: Shutdown complete 131008 00:51:06 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 131008 00:56:51 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql ^G/usr/libexec/mysqld: Can't create/write to file '/home/data/tmp/ibAQO7mX' (Errcode: 13) 131008 0:56:51 InnoDB: Error: unable to create temporary file; errno: 13 131008 0:56:51 [ERROR] Plugin 'InnoDB' init function returned error. 131008 0:56:51 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 131008 0:56:51 [Note] Event Scheduler: Loaded 0 events 131008 0:56:51 [Note] /usr/libexec/mysqld: ready for connections. ------------ 後來是改回/var/lib/mysql才回復正常使用 可是空間不夠我沒辦法把資料繼續運算下去呀囧..... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.120.29.185

10/10 00:34, , 1F
/home/data/mysql 下的所有檔案/目錄權限都對嗎?
10/10 00:34, 1F

10/11 07:57, , 2F
OS 是 Linux 嗎?有沒有 "SELinux" 這個功能?可能與它有關
10/11 07:57, 2F
文章代碼(AID): #1IKtnpgk (Database)
文章代碼(AID): #1IKtnpgk (Database)