Database

MySQL 설치 (바이너리 혹은 소스)

페이지 정보

본문

바이너리 포맷 설치하기

  • MySQL-VERSION.i386.rpm → 서버모듈
  • MySQL-client-VERSION.i386.rpm → 클라이언트 모듈, 이것은 서버는 다른 서버에 인스톨 되어 있고, 그 서버로 접속만 하고 싶을 경우 인스톨 하면 된다.
  • MySQL-devel-VERSION.i386.rpm → library와 include파일. 이것은 MySQL과 관련된 다른 프로그램을 컴파일 할 경우 필요하다.
  • MySQL-VERSION.src.rpm → 소스
위 패키지중 서버 모듈과 클라이언트 모듈을 아래와 같이 설치할 수 있다.
shell> rpm -i MySQL-VERSION.i386.rpm MySQL-client-VERSION.i386.rpm

설치 레이아웃 (Installation Layout)

인스톨 레이아웃은 인스톨 했을때, MySQL과 관련된 파일과 디렉토리를 어느 위치에 생성할 것인지를 결정하는 것이다. 여가가지 레이아웃에 따라 관련된 파일을 다른 디렉토리 위치에 저장한다. 컴파일된 바이너리를 풀어서 특정 디렉토리 (보통은 /usr/local/mysql)에 설치할 경우 아래와 같은 레이아웃이 생성된다.
*Directory*            *Contents of directory*
`bin'                  Client programs and the `mysqld' server
`data'                 Log files, databases
`include'              Include (header) files
`lib'                  Libraries
`scripts'              `mysql_install_db'
`share/mysql'          Error message files
`sql-bench'            Benchmarks
소스를 인스톨 할 경우는 /usr/local 디렉토리에 아래와 같은 레이아웃이 생긴다.
*Directory*            *Contents of directory*
`bin'                  Client programs and scripts
`include/mysql'        Include (header) files
`info'                 Documentation in Info format
`lib/mysql'            Libraries
`libexec'              The `mysqld' server
`share/mysql'          Error message files
`sql-bench'            Benchmarks and `crash-me' test
`var'                  Databases and log files
소스로 인스톨 될 때에는 바이너리로 인스톨 될 때와 달리 아래와 같은 차이가 있다.
* The `mysqld' server is installed in the `libexec' directory rather
  than in the `bin' directory.
     
* The data directory is `var' rather than `data'.
     
* `mysql_install_db' is installed in the `/usr/local/bin' directory
  rather than in `/usr/local/mysql/scripts'.
     
* The header file and library directories are `include/mysql' and
  `lib/mysql' rather than `include' and `lib'.

소스 배포본 설치하기

첫째로 최신의 gcc컴파일러와 make, tar, gunzip이 필요하다. 오래된 컴파일러는 문제를 일으킬 수 있으니 가급적 최신의 것을 확인하여 구하는 것이 좋다. 최신 gcc를 사용한다면 '-fno-exceptions' 옵션을 주는 것이 중요하다. 그렇지 않으면 가끔식 죽어버리는 프로그램으로 컴파일 될 수 있다. 또한 '-fno-exceptions'과 함께 '-felide-contructors''-fno-rtti'도 같이 사용하는 것을 추천한다. 아래와 같이 사용하면 된다.
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions
-fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler
--with-mysqld-ldflags=-all-static
만일 문제가 생기면 'mysqlbug'를 사용하는 것이 좋다. 이것을 이용하여 버그 리포트를 작성할 수도 있자만 보통은 무엇이 문제인지에 대한 정보도 같이 표시해 주기 때문에 문제가 무엇인지 파악할 수도 있다. 이 프로그램은 'scripts'디렉토리에 있다.

간단한 설치 방법

자세한 설명없이 아래와 같은 방법으로 바로 설치할 수 있다.
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> scripts/mysql_install_db
shell> chown -R root  /usr/local/mysql
shell> chown -R mysql /usr/local/mysql/var
shell> chgrp -R mysql /usr/local/mysql
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> /usr/local/mysql/bin/safe_mysqld --user=mysql &
만인 InnoDB테이블 지원을 하고 싶으면, '/etc/my.conf'를 편집하여, 'innodb_...'로 시작하는 줄의 첫번째 '#'를 없애면 된다. 만일 소스 rpm을 가지고 있다면 아래와 같은 방법을 사용한다.
shell> rpm --rebuild MySQL-VERSION.src.rpm
위 명령은 바로 설치할 수 있는 rpm파일을 만들어 준다. 만일 'DBI''Msql-Mysql-modules' Perl모듈이 설치되어 있다면, 'bin/mysql-setpermission' 스크립트를 실행하여 새로운 사용자를 추가할 수 있다.

참고문서

  • 소스에 포함된 INSTALL-SOURCE 문서

관련자료

등록된 댓글이 없습니다.
Today's proverb
시계를 꺼내어 자랑하듯 학식을 꺼내 보이지 말라. 대신 누군가 시간을 물어보면 조용히 시간만 알려주어라.