본문 바로가기

Linux(CentOS)

mysql 컴파일 설치


CentOS 5.8 설치에 이어서 Mysql comfile 설치를 해보자.

mysql을 설치하기 전에 해당 라이브러리를 먼저 설치하자.

yum -y install gcc gcc-c++ termcap libtermcap libtermcap-devel gdbm-devel zlib* libxml* freetype* libpng* libjpeg* \

gd gd-devel libmcrypt libmcrypt-devel mhash mhash-devel apr apr-*  libxml2 iconv unixODBC qpixman qpixman-devel dialog xorg-x11-devel 

설치할 mysql5.0.77 버전을 다운받아야 할텐데 구글링으로 어렵지 않게 구할수 있다.

wget 으로 다운 받아보자.

wget http://mirror.koreaidc.com/mysql/mysql-5.0.77.tar.gz


이제 다운 받은 파일을 압축을 풀자

# tar -xvzf ./mysql-5.0.77.tar.gz

설치를 하기전에 yum으로 혹시나 설치 되어 있을지 모를 mysql을 지우자

rpm -e mysql --nodeps 

mysql 사용자 추가

useradd -M mysql -u 27   

그리고 압축푼 디렉토리로 이동

# cd ./mysql-5.0.77 

디렉토리의 configure 를 통해 기본 구성을 설정하자

http://ko.wikipedia.org/wiki/Configure <-- 부가 설명이 필요한 사람은 여기로

configure 는 다음과 같다.

./configure \

--prefix=/usr/local/mysql \

--enable-thread-safe-client \

--with-unix-soket-path=/usr/local/mysql/tmp \

--with-charset=latin1 \

--with-client-ldflags=-all-static \

--with-mysqld-ldflags=-all-static \

--without-debug --with-innodb \

--with-readline \

--with-berkeley-db --without-bench \

--with-extra-charsets=complex \

--with-charset=utf8 \

--localstatedir=/free/mysql_data

각각의 구성이 뜻하는 부분을 알아도록 하자.

make 명령으로 설치를 한다.

# make

# make install

my.cnf 파일을 수정해야 하지만 일일이 하기엔 힘드므로..

# cp /usr/local/mysql/share/mysql/my-large.cnf /etc/my.cnf

# perl -pi -e "s/log-bin/#log-bin/g" /etc/my.cnf

mysql의 데이터베이스를 생성

# /usr/local/mysql/bin/mysql_install_db 

일반적으로는 /home 디렉토리에 설치되는게 맞겠지만

configure 설정을 할때 /free/mysql_data 로 구성을 했었다.

위와 같은 화면이 나오는 경우가 있는데 my.cnf 설정된 내용으로 DB가 구성되는데

option 'max_join_size' 이부분은 굳이 설정안해도 된다.


cd /usr/local/mysql/share/mysql 이동

mysql.server 파일의 권한을 수정하자.

# chmod 700 mysql.server

이파일을 mysql 시작파일로 설정해보자.

# cp -p ./mysql.server /usr/bin

# cp -a /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld

ll /etc/rc.d/init.d/| grep mysqld 확인하면 

mysql 의 권한 설정 권한 설정을 하지않으면 제대로 작동하지 않는다.

chown -R root /usr/local/mysql

chown -R mysql /free/mysql_data

# chgrp -R mysql /usr/local/mysql

이제 mysql.server 를 .bash_profile 에 등록하자.

.bash_profile 은 root 홈디렉토리에 있다.

#cd ~

#vi .bash_profile



PATH=$PATH:$HOME/bin    ->   PATH=$PATH:$HOME/bin:/usr/bin

수정된 값들이 적용 되도록 하자.

#source .bash_profile 

# mysql.server start    or   # /etc/rc.d/init.d/mysqld start

정상적으로 작동되는지 확인하자


마지막으로 mysql이 시스템 재부팅이 되어도 시작되도록 등록하면 끝

# chkconfig --add mysqld

'Linux(CentOS)' 카테고리의 다른 글

centos 7.X 설치 GUI server  (0) 2019.05.28
ssh root 접속 제한 설정  (0) 2016.01.18
Single booting (root 패스워드 초기화)  (0) 2016.01.16
CentOS설치(5.8)  (0) 2014.08.31