행복님 avatar

mysql windows 버전에서 Data 변경시 오류 해결

jaerakson

Published: 20 Sept 2018 › Updated: 20 Sept 2018mysql windows 버전에서 Data 변경시 오류 해결

mysql windows 버전에서 Data 변경시 오류 해결

mysql windows 버전에서 Data 경로 변경시 오류 발생합니다.

결론을 말하지면 데이터 경로 복사시 권한 복사 되지 않아 오류 발생 합니다.

해결 방법은

1. 데이터 경로의 권한 추가 
2. mysql 실행 권한 변경 

자세한 내용은 아래의 내용을 보시면 이해 되실 꺼에요

mysql 처음 설치시 datadir ( C:/ProgramData/MySQL/MySQL Server 5.7/Data)

mysql (my.ini) config 파일 (C:\ProgramData\MySQL\MySQL Server 5.7\my.ini) 열어서
datadir 항목을 보시면 됩니다.

datadir=C:/ProgramData/MySQL/MySQL Server 5.7/Data

datadir 경로를 변경해 보겠습니다 아래의 단계로 진행 하시면 됩니다.

  1. mysql stop
    net stop mysql

  2. my.ini 에서 데이터 경로 변경
    datadir=D:\MYSQLData

  3. 소스 데이터 폴드를 목적 데이터 폴드 copy
    xcopy "C:\ProgramData\MySQL\MySQL Server 5.7\Data" D:\MYSQLData /s

  4. mysql start


그러나 DB는 시작 되지 않고 오류 발생

2018-09-18T22:46:29.760364Z 0 [Note] Plugin 'FEDERATED' is disabled.
2018-09-18T22:46:29.760603Z 0 [ERROR] InnoDB: Operating system error number 5 in a file operation.
2018-09-18T22:46:29.760814Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory. It may also be you have created a subdirectory of the same name as a data file.
2018-09-19 07:46:29 0xb80  InnoDB: Assertion failure in thread 2944 in file fil0fil.cc line 896
InnoDB: Failing assertion: success
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html

결론을 말하지면 데이터 복사 할때 권한 누락 되서 발생하는 문제 입니다.

services.msc 열어보시면

   Network Service   . 

폴드의 권한 확인 해보겠습니다. ( Network Service 권한 존재함)

C:/ProgramData/MySQL/MySQL Server 5.7/Data

D:\MYSQLData ( Network Service 권한 존재 안함)

즉 Network Service 권한이 없어서 mysql 이 해당 폴드의
권한 없어서 실행 하지 못합니다.

해결 방법은

  1. 데이터 경로의 Network Service  권한 추가 
  2. mysql 실행 권한 변경 

Network Service 권한 추가 후 mysql start 하면 정상화 됩니다.


마지막으로 Network Service 계정은 아래의 역할 을 합니다.

Network Service         

          
        . 

Network Service     
            

       
      .

Leave mysql windows 버전에서 Data 변경시 오류 해결 to:

Written by

Read more #kr posts


Best Posts From 행복님

We have not curated any of jaerakson's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From 행복님