음.. 제목이 낚시성이긴 한데... 하도 가끔 설치를 하다보니 한번 설치하면 담에 설치할 때 까먹고 해서.. 정리할 겸 적어본다.

다른 건 다 상관없는데, mysql사이트의 install 방법을 보다보면, mysql설치시 다음과 같이 db를 초기화 하는 부분이 있다.
shell> scripts/mysql_install_db --user=mysql

이렇게 초기화를 하게되면, 내가 원하는 위치에 설치되지 않고 mysql이 정한 기본 경로를 따르게 된다.
또한 mysql 프로세스를 띄우는 방식 역시 메뉴얼에 나온데로 아래와 같이

bin/mysqld_safe  --user=mysql &

띄울 경우, 처음 설치한 사람은 그렇다쳐도 다른 사람이 해당 서버에서 process만 확인해서는 my.cnf가 어디에 있는지, 혹시 여러개의 my.cnf가 존재하는 경우 어떤 my.cnf를 사용해 서버가 시작되었는지 헷갈리는 문제가 있다.

File Name Purpose
/etc/my.cnf Global options
SYSCONFDIR/my.cnf Global options
$MYSQL_HOME/my.cnf Server-specific options
defaults-extra-file The file specified with --defaults-extra-file=path, if any
~/.my.cnf User-specific options

위 순서는 unix 기준이고, windows는 
File Name Purpose
WINDIR\my.iniWINDIR\my.cnf Global options
C:\my.iniC:\my.cnf Global options
INSTALLDIR\my.iniINSTALLDIR\my.cnf Global options
defaults-extra-file The file specified with --defaults-extra-file=path, if any

그래서 아래와 같은 방법으로 설치를 하고 프로세스를 띄우는 것이 좋은것 같다.
일단 my.cnf를 먼저 준비(my.cnf파일 내부 옵션들에 대한 설명)를 하고, 해당 설정파일 내부에 설치를 원하는 위치 등의 정보를 먼저 수정한 후,초기화 script시 parameter로 해당 my.cnf의 위치를 전달해 주고
shell> scripts/mysql_install_db --defaults-file=/etc/my.cnf --user=mysql

mysql 프로세스를 띄울 때도, 아래와 같이 parameter로 my.cnf 파일의 위치를 전달해 주면,
bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql &

설치자 외에도 해당 서버에서 process만 mysql을 grep해 보면, my.cnf 위치가 명시되어 있어 보다 쉽게 파악이 가능하다는 점이 있다.

보다 자세한 설치 방법은 이글을 참고하면 좋을 것 같다.

+ Recent posts