debian mysql目录_在Debian 7中更改Mysql数据目录?

我有一个单独的分区,包含我的www和

mysql文件夹.

我在启动时将该分区设置为automount,并且apache2启动正常,没有错误.

但是,当我刚刚删除所有mysql-server-5.5的痕迹时,重新启动然后重新启动它,它会正常工作.

但第二个我改变my.cnf指向/ media / server / mysql,并尝试启动mysql然后它出错了.

这是我到目前为止所遵循的步骤列表.请注意,据我所知,Debian没有apparmor,所以我跳过了那一步.

Stop MySQL using the following command:

sudo /etc/init.d/mysql stop

Copy the existing data directory (default located in /var/lib/mysql) using the following command:

sudo cp -R -p /var/lib/mysql /newpath

edit the MySQL configuration file with the following command:

gedit /etc/mysql/my.cnf

Look for the entry for datadir, and change the path (which should be /var/lib/mysql) to the new data directory.

In the terminal, enter the command:

sudo gedit /etc/apparmor.d/usr.sbin.mysqld

Look for lines beginning with /var/lib/mysql. Change /var/lib/mysql in the lines with the new path.

Save and close the file.

Restart the AppArmor profiles with the command:

sudo /etc/init.d/apparmor reload

Restart MySQL with the command:

sudo /etc/init.d/mysql restart

Now login to MySQL, and you can access the same databases you had before.

我的猜测是这是一个权限问题,但我可能是错的.

root@debian:~# chown -R mysql:mysql /media/server/mysql

root@debian:~# sudo /etc/init.d/mysql restart

[ ok ] Stopping MySQL database server: mysqld.

[FAIL] Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!

我承认我仍然是Linux的新手,所以我可能会做其他人推荐的事情,而不是真正理解它的真正含义.

它没有详细说明它失败的原因.

我可能会考虑做的另一个选择是重新启用它以使用默认数据dir,然后只是从分区中复制mysql文件.

但这否定了为webdev设置专用分区的重点.

感谢您的任何意见或努力,谢谢.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值