2016-12-08 2 views
0

MySQL 5.7 및 CentOS 7.2를 사용합니다. 처음에는MySQL 5.7 데이터 변경

는 my.cnf 파일 내 DATADIR 구성은은/var/lib 디렉토리/mysql을

가 지금은 DATADIR을 변경하고 싶습니다.

나는 두 가지 방법을 시도 하바 :

첫째,/집/데이터는/var/lib 디렉토리/mysql을에있는 모든 파일과 디렉토리를 복사하고 chown -R mysql:mysql /home/data를 실행합니다. 난은/var/lib 디렉토리/mysql을에/홈 이동은/var/lib 디렉토리에 ln -s /home/mysql mysql을 실행

2016-12-08T16:33:38.206780Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable 
2016-12-08T16:33:38.206806Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable 
2016-12-08T16:33:38.206817Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error 
2016-12-08T16:33:38.807398Z 0 [ERROR] Plugin 'InnoDB' init function returned error. 
2016-12-08T16:33:38.807421Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 
2016-12-08T16:33:38.807429Z 0 [ERROR] Failed to initialize plugins. 
2016-12-08T16:33:38.807436Z 0 [ERROR] Aborting 

둘째 : 나는 systemctl start mysqld을 실행할 때, 나는 오류 메시지가 표시됩니다. 내가 systemctl start mysqld를 실행하면, 나는 오류 메시지 :

2016-12-08T16:48:28.958136Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation. 
2016-12-08T16:48:28.958165Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory. 
2016-12-08T16:48:28.958174Z 0 [ERROR] InnoDB: os_file_get_status() failed on './ibdata1'. Can't determine file permissions 
2016-12-08T16:48:28.958184Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error 
2016-12-08T16:48:29.558751Z 0 [ERROR] Plugin 'InnoDB' init function returned error. 
2016-12-08T16:48:29.558792Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 
2016-12-08T16:48:29.558806Z 0 [ERROR] Failed to initialize plugins. 
2016-12-08T16:48:29.558817Z 0 [ERROR] Aborting 

나는 그것으로 어떻게 처리 할 수 ​​있습니까?

+0

나는 창문에서이 문제가 있었다. 일단 로그 파일을 삭제하면 서비스가 제대로 시작됩니다. 백업을 가지고 있고 다시 서비스를 시작하려고하면 ibdata1이 로그 파일이됩니다. – Rajesh

+0

@Rajesh 모든'ib_logfile'을 삭제하려고했습니다. 그러나 그것은 효과가 없습니다. 고마워. – lbear

+0

어디서 문제를 해결할 수 있습니까? –

답변

0

이 문제는 서브 디렉토리의 허가 에 대해 그리고 당신은 /etc/apparmor.d/local/usr.sbin.mysqld /data/ r, /data/** rwk, 깜빡하지 않는이 파일을 편집해야합니다, 당신은 우분투에서이 문제에 대한이

sudo service apparmor reload

처럼에 CentOS에서 동일한 명령을 찾아야한다 SYS는 링크 참조

https://askubuntu.com/questions/758898/mysql-wont-start-after-changing-the-datadir-14-04-mysql-5-7/795710#795710

행복한 날, 나쁜 사람

관련 문제