linux - Change Mysql Data Directory in Debian 7? -


i have separate partition holds both www , mysql folders.

i have partition set automount @ boot, , apache2 starts fine, no errors.

however, when removed traces of mysql-server-5.5, rebooted restarted it, work normally.

but second make changes my.cnf point /media/server/mysql, , try start mysql error's out.

here list of steps have followed far. advised, debian not have apparmor, far know, skipped step.

stop mysql using following command:  sudo /etc/init.d/mysql stop  copy existing data directory (default located in /var/lib/mysql) using following command:  sudo cp -r -p /var/lib/mysql /newpath  edit mysql configuration file following command:  gedit /etc/mysql/my.cnf  entry datadir, , change path (which should /var/lib/mysql) new data directory.  in terminal, enter command:  sudo gedit /etc/apparmor.d/usr.sbin.mysqld  lines beginning /var/lib/mysql. change /var/lib/mysql in lines new path. save , close file.  restart apparmor profiles command:  sudo /etc/init.d/apparmor reload  restart mysql command:  sudo /etc/init.d/mysql restart  login mysql, , can access same databases had before. 

from how change mysql data directory?

although looked @ link here https://askubuntu.com/questions/137424/moving-mysql-datadir

my guess permissions issue, wrong.

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! 

i'll admit still newb @ linux, may doing things, other's recommend, without understanding doing.

it gives no details why failing.

one other option, may consider doing, re-enable use default data dir, , copy mysql files partition.

but denies whole point of having dedicated partition webdev.

i appreciate comments or efforts, thank you.

instead of copying original datadir (/var/lib/mysql), should move it. keeps better track on metadata.

insted of:

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

use:

sudo mv /var/lib/mysql /newpath 

or better save copy of original datadir , move it, this:

sudo cp -r -p /var/lib/mysql /var/lib/mysql.bak sudo mv /var/lib/mysql /newpath 

then start mysql service, should go smoothly :)

cheers!


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -