ubuntu下如何更改mysql数据存放路径
六月 23rd, 2010 Posted in mysql | 阅读次数: 430 次
制作:高进波
时间:2010-6-23
很多时候,mysql的数据会非常大,数据默认放在/var/lib/mysql,由于/var所划分的空间不够大,所以我们需要将mysql数据存放路径修改一下,放到大分区里面,以便可以应付mysql数据增长。
1.设置新的存放路径
mkdir -p /data/mysql
2.复制原有数据
cp -R /var/lib/mysql/* /data/mysql
3.修改权限
chown -R mysql:mysql /data/mysql
4.修改配置文件
vim /etc/mysql/my.cnf datadir = /data/mysql
5.修改启动文件
vim /etc/apparmor.d/usr.sbin.mysqld #把 /var/lib/mysql r, /var/lib/mysql/** rwk, #改成 /data/mysql r, /data/mysql/** rwk,
6.重启服务
重启apparmor
/etc/init.d/apparmor restart /etc/init.d/mysql restart
完成
相关日志:
Tags: mysql
六月 24th, 2010 at 08:00
博主,闷。我的友情链接写错啦,
名称是:羽风 don’t 腾讯羽风,最讨厌腾讯······
八月 10th, 2011 at 10:15
Great website…
[...]we like to honor many other internet sites on the web, even if they aren’t linked to us, by linking to them. Under are some webpages worth checking out[...]………
九月 11th, 2011 at 17:34
Websites you should visit…
[...]below you’ll find the link to some sites that we think you should visit[...]……