2009. 7. 15. 04:29

레드헷 계열 리눅스에서 MySQL설치


리눅스 DB설치 3번째 DB 포스팅으로 MySQL입니다.
MySQL은 그전에도 무들에 관한 포스팅을 써본적이 있고... 너무 많은 사람들이 애용하고 사용하는 DB이기 때문에 포스팅에 남길 글이 뭐 없네요.... 구색을 맞추기 위해..어차피 새 테스터 시스템을 만드는거니깐 그냥 자취만 남기는 포스팅을 합니다... 이렇게 포스팅을 남겨두면 나중에 시스템을 구성할때 너무나 편하답니다.

다운받는곳
 http://www.snowrice.com/?module=file&act=procFileDownload&file_srl=851&sid=d3755b335988fa2bf2f0465b97d6e6be

 [root@akas Desktop]# tar -xvf mysql-5.1.32.tar.gz
생략
mysql-5.1.32/plugin/fulltext/configure.in
mysql-5.1.32/configure.in
mysql-5.1.32/Makefile.in
[root@akas Desktop]# cd mysql-5.1.32

[root@akas mysql-5.1.32]# ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --with-charset=utf8 --with-mysql-user=mysql --sysconfdir=/etc --enable-thread-safe-client
생략
Remember to check the platform specific part of the reference manual for
hints about installing MySQL on your platform. Also have a look at the
files in the Docs directory.

Thank you for choosing MySQL!
[root@akas mysql-5.1.32]#make
생략
make[2]: Leaving directory `/root/Desktop/mysql-5.1.32/server-tools/instance-manager'
make[1]: Leaving directory `/root/Desktop/mysql-5.1.32/server-tools'
Making all in win
make[1]: Entering directory `/root/Desktop/mysql-5.1.32/win'
make[1]: `all'를 위해 할 일이 없습니다
make[1]: Leaving directory `/root/Desktop/mysql-5.1.32/win'
[root@akas mysql-5.1.32]#make install
생략
make[1]: Entering directory `/root/Desktop/mysql-5.1.32/win'
make[2]: Entering directory `/root/Desktop/mysql-5.1.32/win'
make[2]: `install-exec-am'를 위해 할 일이 없습니다
make[2]: `install-data-am'를 위해 할 일이 없습니다
make[2]: Leaving directory `/root/Desktop/mysql-5.1.32/win'
make[1]: Leaving directory `/root/Desktop/mysql-5.1.32/win'


컴파일끝... 세부설정 시작
DB생성..

 [root@akas mysql-5.1.32]# ls /usr/local/
bin  etc  games  include  lib  libexec  mysql  pgsql  sbin  share  src
[root@akas mysql-5.1.32]#  /usr/local/mysql/bin/mysql_install_db
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h akas.com password 'new-password'

Alternatively you can run:
/usr/local/mysql/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/local/mysql/bin/mysqlbug script!

The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/


DB생성확인과 계정생성

 [root@akas mysql-5.1.32]# ls /usr/local/mysql/data
mysql  test
[root@akas mysql-5.1.32]# cat >> /etc/ld.so.conf
/usr/local/mysql/lib

[root@akas mysql-5.1.32]# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/mysql/lib

[root@akas mysql-5.1.32]# ldconfig
[root@akas mysql-5.1.32]# cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
[root@akas mysql-5.1.32]# groupadd mysql
[root@akas mysql-5.1.32]# adduser -M -c Mysql_server -d /usr/local/mysql -g mysql -s /sbin/nologin mysql
[root@akas mysql-5.1.32]# chown root.mysql -R /usr/local/mysql/
[root@akas mysql-5.1.32]# chown mysql.mysql -R /usr/local/mysql/data
[root@akas mysql-5.1.32]# cd /usr/local/mysql/bin


my.cnf오류처리

 [root@akas bin]# vi /etc/my.cnf
# Disable Federated by default
#skip-federated(주석처리)

데몬 실행 & 관리자 루트 비밀번호 생성
 [root@akas bin]# ./mysqld_safe --user=mysql &
[2] 26772
[root@akas bin]# 090715 04:34:38 mysqld_safe Logging to '/usr/local/mysql/data/akas.com.err'.
090715 04:34:38 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
[root@akas bin]# ./mysqladmin -uroot -p password 1234
Enter password:

설정끝 _ 부팅시 자동 로딩
 [root@akas bin]# vi /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
/etc/init.d/oracle start
/etc/rc.d/init.d/postgresql start
/etc/local/mysql/bin/mysqld_safe --user=mysql &


노란색부분만 Ctrl+C Ctrl+V 끝남...