Linux

Mysql 설치.... APM(2/3)

욕정의노예 2009. 6. 14. 01:03
http://www.mysql.com/ 에서 우선 소스로 다운을 받습니다....

RPM 버전과 소스 설치 버전에 대해서... 할 말은... 끝으로 미루고... ㅎㅎㅎㅎ

우선 고고싱....

1. configure

[root@cow mysql-5.0.22]# ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --with-charset=euckr --with-mysqld-user=mysql --with-openssl --with-readline --enable-thread-safe-client --sysconfdir=/etc

..........
.........

hints about installing MySQL on your platform. Also have a look at the
files in the Docs directory.

Thank you for choosing MySQL!

[root@cow mysql-5.0.22]#

자 여기까지 보면 우선 configure 가 끝난겁니다 ㅎㅎㅎ 그렇죠..

configure 성공!!!!!!!

옵션같은 경우는 대략 다 아시겟죠 풋... 모르면 그냥 저리 쓰세요..



2. make

[root@cow mysql-5.0.22]# make

........

make[2]: Leaving directory `/usr/local/src/mysql-5.0.22/server-tools'
make[1]: Leaving directory `/usr/local/src/mysql-5.0.22'
[root@cow mysql-5.0.22]#

여기까지 나오면 make 성공!!!!



3. make install

[root@cow mysql-5.0.22]# make install

.......

make[2]: Leaving directory `/usr/local/src/mysql-5.0.22/server-tools'
make[1]: Leaving directory `/usr/local/src/mysql-5.0.22'
[root@cow mysql-5.0.22]#

여기까지 나오면 make install 성공!!!!



2부!!!! 설치 후 설정들.. (1부는 ... 없었는데...)

원래 설치보다 설정하는것들이 더 짜증날 수 있습니다... 물론 컴파일 안되고 그라면 돌아버리지만 ㅎㅎㅎ

이것도 대략 손으로 셀 수 없을만큼 해보면 그다지 어렵지 않습니다. ㅎ


4.데이터베이스 생성

우선 Mysql 의 데이터베이스인 data 디렉토리 (--localstatedir=/usr/local/mysql/data 로 설정했던...)를

생성해야 합니다... 자동으로 만들어지지 않습니다!! 생성 방법은 설치 디렉토리로 가셔서

/usr/local/mysql/bin/mysql_install_db 라는 파일을 실행합니다.

그렇게 하면 이런 말들과 함께 생성이 되죠...

Installing all prepared tables
Fill help tables

...............

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
[root@cow bin]#

이렇게 나오면 성공!!!



5. 라이브러리 위치 지정

자 그 이후에 라이브러리 위치를 지정합니다.

/etc/ld.so.conf 파일안에  마지막 줄에

/usr/local/mysql/lib/mysql

디렉토리를 추가합니다. (prefix 옵션에서 디렉토리를 다르게 설정하신 분들은 이 위치도 바뀌어야 겠죠...)

그리고

[root@cow mysql]# ldconfig

을 실행하면 적용이 됩니다. 이상!!!



6. 설정 파일 복사

[root@cow mysql]# cp /usr/local/mysql/share/mysql/my-large.cnf /etc/my.cnf

이 명령어로 설정 파일을 복사해줍니다 ㅎㅎㅎㅎㅎ 이상!!



7. mysql 계정 및 그룹 생성 및 권한 변경

mysql 데몬을 관리하고 뭐 이것저것 하는데 필요한(필요하다기 보다는...음... 뭐라고 해야 하나...

암튼 뭐 안전한, 관리하기 편한) 계정과 그룹을 만듭니다.

[root@cow mysql]# groupadd mysql
[root@cow mysql]# useradd -M -d /usr/local/mysql -g mysql -s /bin/nologin mysql

[root@cow mysql]# chown root.mysql -R /usr/local/mysql
[root@cow mysql]# chown mysql.mysql -R /usr/local/mysql/data




8. 부팅 시 자동으로 띄워지게 하기

[root@cow mysql]# cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
[root@cow mysql]# chkconfig --level 3 mysqld on
[root@cow mysql]# chkconfig --level 5 mysqld on


으로 3번, 5번 레벨에서 부팅시 자동으로 실행되도록 합니다.!!



9. 그냥 실행할 때

[root@cow bin]# ./mysqld_safe --user=mysql &
[1] 20217
[root@cow bin]# Starting mysqld daemon with databases from /usr/local/mysql/data

[root@cow bin]#

이렇게 나오면 실행이 된겁니다 ㅎㅎㅎㅎ 그럼 여기까지 입니다.



10. 설치 후기

사실 mysql 은 RPM 설치가 더 낫다고 합니다. 소스설치로 설정(configure 로 하는거)을 하더라도...

물론 옵션을 다 제대로 아는 사람도 없을 뿐더러 하기도 힘들다는 말입니다!!

실제로 둘을 검사(비교..)해보면 RPM 설치본이 더 빠르다고 그러더군요....

하지만...!!!

중요한 사실은 RPM 설치야 뭐 하면 되죠!! rpm -Uvh ....  혹은 yum -y install mysql*  등등...

쉽죠... 설정 파일... 관리도 mysql 은 할게 별로 없습니다... 누워서 떡먹기... 암튼 쉽습니다..

우리가 알고 싶은건 역시나 .. 소스 설치 방법...

그리고 저는 이 고달픈 소스설치를 즐깁니다. 막혔을 때 사람 빡돌게 했다가 설치 후의 그 쾌감은

이 루 말 할 수없 죠 . . .   해본 사람만 알 수 있는거죠 ㅋㅋㅋㅋ 그럼 여기까지 입니다.