Estou tentando mover o diretório de dados do MySQL para uma unidade externa em um odroid (mini-computador parecido com uma framboesa).
Estou usando o Ubuntu 14.04.
Eu mudei os caminhos em todos os arquivos de configuração contendo /var/lib/mysql
e movi todas as pastas mysql na minha nova unidade.
O serviço não começa mais e eu não sei como consertar isso.
Aqui estão todos os caminhos alterados:
root@odroid-server:/etc# grep -rnw '/etc' -e "/var/lib/mysql"
root@odroid-server:/etc# grep -rnw '/etc' -e "/media/md0/mysql"
/etc/apparmor.d/abstractions/mysql:12: /media/md0/mysql{,d}/mysql{,d}.sock rw,
/etc/apparmor.d/tunables/alias:16:# alias /media/md0/mysql/ -> /home/mysql/,
/etc/apparmor.d/usr.sbin.mysqld:49: /media/md0/mysql/ r,
/etc/apparmor.d/usr.sbin.mysqld:50: /media/md0/mysql/** rwk,
/etc/apparmor.d/usr.sbin.mysqld:53: /media/md0/mysql-files/ r,
/etc/apparmor.d/usr.sbin.mysqld:54: /media/md0/mysql-files/** rwk,
/etc/apparmor.d/usr.sbin.mysqld:57: /media/md0/mysql-keyring/ r,
/etc/apparmor.d/usr.sbin.mysqld:58: /media/md0/mysql-keyring/** rwk,
/etc/imscp/imscp.conf:37:DATABASE_DIR = /media/md0/mysql
/etc/mysql/mysql.conf.d/mysqld.cnf:36:datadir = /media/md0/mysql
/etc/mysql/mysql.conf.d/mysqld.cnf:92:# InnoDB is enabled by default with a 10MB datafile in /media/md0/mysql/.
/etc/mysql/mysql.conf.d/mysqld.cnf:98:# chroot = /media/md0/mysql/
Em seguida, iniciar o serviço:
root@odroid-server:/etc# service mysql start
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
Eu tentei esse comando para mais detalhes e posso ver que ele ainda usa o antigo datadir do mysql.
root@odroid-server:/etc# journalctl -xe
Nov 18 13:06:45 odroid-server systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Nov 18 13:06:45 odroid-server mysql-systemd-start[24276]: MySQL data dir not found at /var/lib/mysql. Please create one.
Nov 18 13:06:45 odroid-server systemd[1]: mysql.service: Control process exited, code=exited status=1
Nov 18 13:06:45 odroid-server systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Nov 18 13:06:45 odroid-server systemd[1]: mysql.service: Unit entered failed state.
Nov 18 13:06:45 odroid-server systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 18 13:06:45 odroid-server systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Nov 18 13:06:45 odroid-server systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Nov 18 13:06:45 odroid-server systemd[1]: mysql.service: Start request repeated too quickly.
Nov 18 13:06:45 odroid-server systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Talvez haja algum comando para recarregar os arquivos de configuração no RAM?