我有一个单独的分区,包含我的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设置专用分区的重点.
感谢您的任何意见或努力,谢谢.