Good Day

[MySQL] MySQL 5.6.27 zip으로 Windows에 설치하기. 본문

개발/MySQL

[MySQL] MySQL 5.6.27 zip으로 Windows에 설치하기.

영악 2015. 10. 6. 11:14

아주 주옥같은 4시간을 보내고 로깅.


 MySQL 5.6.27 zip으로 Windows에 설치하기.



구관이 명관이라고 개인적으로 개발하는 프로젝트의 DB를 MySQL로 돌려보려고 이리저리 준비하던 중, Windows에 MySQL을 깔고 써본적이 없는터라 원하는데로 설치하는데 애를 먹었다.


설치환경

- OS: Windows 2012 R2 64bit

- MySQL: 5.6.27 64bit

- BaseDir: C:\MySQL

- DataDir: D:\MySQL\Data

- LogDir: D:\MySQL\Log


실패사례#1


.MSI파일로 설치시도

> 설치 진행시 모든 경로를 지정해줘도 계속 기본 폴더로 위치잡힘.

> 64bit/32bit 모두 같은 문제 발생

> 우여곡절 끝에 my.ini파일 위치 찾아서 변경 시도 했으나 실패


실패사례#2


zip파일로 설치시도

> 단순히 BaseDir 위치에 my.ini파일 생성하고 시도했으나 씨알도 안먹힘

> c:\에도 넣어보고, c:\windows에도 넣어보고, 기본 생성 폴더에도 넣어봤는데 씨알도 안먹힘


성공사례


> 실패사례#1에서 기본적으로 설치된 my.ini 파일과 실패사례#2에서 나온 파일이 서로 다름을 확인

실패사례#1의 my.ini 파일을 분석하다보니 아래와 같은 내용을 발견

(※ 진하게 볼드칠한게 힌트)



# Other default tuning values

# MySQL Server Instance Configuration File

# ----------------------------------------------------------------------

# Generated by the MySQL Server Instance Configuration Wizard

#

#

# Installation Instructions

# ----------------------------------------------------------------------

#

# On Linux you can copy this file to /etc/my.cnf to set global options,

# mysql-data-dir/my.cnf to set server-specific options

# (@localstatedir@ for this installation) or to

# ~/.my.cnf to set user-specific options.

#

# On Windows you should keep this file in the installation directory 

# of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To

# make sure the server reads the config file use the startup option 

# "--defaults-file". 

#

# To run run the server from the command line, execute this in a 

# command line shell, e.g.

# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"

#

# To install the server as a Windows service manually, execute this in a 

# command line shell, e.g.

# mysqld --install MySQLXY --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"

#

# And then execute this in a command line shell to start the server, e.g.

# net start MySQLXY



> 저정도는 다 읽을줄 안다는 가정하에(난 일부 구글번역기를 돌렸지만) 중요한건 --defaults-file 옵션으로 ini파일을 강제로 설정할 수 있다라는 것.

> 커맨드창에서 압축 풀어놓은 폴더로 이동해서 설치 옵션 주고 설치

mysqld --install [서비스이름] --defaults-file="[my.ini위치]"

※ 경로는 역슬래시가 아닌 그냥 슬래시로 입력



> my.ini파일에서 base와 data 디렉토리 위치 변경


※ 공백이나 특문이 있다면 쌍따옴표로 감싸세요


> 서비스 실행

> DB 접속해서 수정하고 원하는데로 가지고 노시면 됩니다.

※ 기타 설정은 my.ini에서 알아서 수정하세요!



'개발 > MySQL' 카테고리의 다른 글

[View] 멍청하게 뷰를 쓰지 말자.  (0) 2015.06.23
Comments