作者zmack0905 (降太)
看板Database
标题[SQL ] mysql5.6 修改资料库路径 ?
时间Tue Oct 8 11:30:55 2013
因为硬碟空间不够用了,想把资料移到/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
1F:→ danny8376:/home/data/mysql 下的所有档案/目录权限都对吗? 10/10 00:34
2F:推 uziel:OS 是 Linux 吗?有没有 "SELinux" 这个功能?可能与它有关 10/11 07:57