STEP 1.

[root@Cacti download]# pwd
/download
[root@Cacti download]# ll
total 50232
-rw-r--r-- 1 root root  6806786 Dec 13 23:35 httpd-2.2.11.tar.gz
-rw-r--r-- 1 root root 32514150 Dec 19 03:01 mysql-5.0.75.tar.gz
-rw-r--r-- 1 root root 12046184 May  1  2008 php-5.2.6.tar.gz

[root@Cacti download]#

위 경로에서 다운 받은 mysql 파일의 압축을 푼다.

[root@Cacti download]# tar xvfz mysql-5.0.75.tar.gz
..... 너무 길어서 생략..........
mysql-5.0.75/win/data/mysql/help_relation.MYI
mysql-5.0.75/win/data/mysql/help_relation.MYD
mysql-5.0.75/win/data/mysql/help_keyword.frm
mysql-5.0.75/win/data/mysql/help_keyword.MYI
mysql-5.0.75/win/data/mysql/help_keyword.MYD
mysql-5.0.75/win/data/mysql/time_zone_name.frm
mysql-5.0.75/win/data/mysql/time_zone_name.MYI
mysql-5.0.75/win/data/mysql/time_zone_name.MYD
mysql-5.0.75/win/data/mysql/time_zone.frm
mysql-5.0.75/win/data/mysql/time_zone.MYI
mysql-5.0.75/win/data/mysql/time_zone.MYD
mysql-5.0.75/win/data/mysql/time_zone_transition.frm
mysql-5.0.75/win/data/mysql/time_zone_transition.MYI
mysql-5.0.75/win/data/mysql/time_zone_transition.MYD
mysql-5.0.75/win/data/mysql/time_zone_transition_type.frm
mysql-5.0.75/win/data/mysql/time_zone_transition_type.MYI
mysql-5.0.75/win/data/mysql/time_zone_transition_type.MYD
mysql-5.0.75/win/data/mysql/time_zone_leap_second.frm
mysql-5.0.75/win/data/mysql/time_zone_leap_second.MYI
mysql-5.0.75/win/data/mysql/time_zone_leap_second.MYD
mysql-5.0.75/win/data/mysql/proc.frm
mysql-5.0.75/win/data/mysql/proc.MYI
mysql-5.0.75/win/data/mysql/proc.MYD
mysql-5.0.75/win/data/mysql/procs_priv.frm
mysql-5.0.75/win/data/mysql/procs_priv.MYI
mysql-5.0.75/win/data/mysql/procs_priv.MYD
mysql-5.0.75/win/data/test/

[root@Cacti download]#




MySQL을 실행 할 계정을 만든다.

[root@Cacti download]# useradd -M -s /bin/false mysql
[root@Cacti download]#




STEP 2.

configure를 해 준다.

[root@Cacti download]# cd mysql-5.0.75
[root@Cacti mysql-5.0.75]# ./configure --prefix=/usr/local/server/mysql --with-extra-charsets=all
........ 길어서 생략 ........
config.status: creating read/Makefile
config.status: creating rem/Makefile
config.status: creating row/Makefile
config.status: creating srv/Makefile
config.status: creating sync/Makefile
config.status: creating thr/Makefile
config.status: creating trx/Makefile
config.status: creating usr/Makefile
config.status: creating ib_config.h
config.status: ib_config.h is unchanged
config.status: executing depfiles commands

MySQL has a Web site at http://www.mysql.com/ which carries details on the
latest release, upcoming features, and other information to make your
work or play with MySQL more productive. There you can also find
information about mailing lists for MySQL discussion.

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@Cacti mysql-5.0.75]#


--prefix=/usr/local/server/mysql 은 /usr/local/server/mysql에 바이너리를 설치하는 옵션이다.

--with-charset=utf8은 기본 문자셋을 utf8로 지정한다.

--with-extra-charsets=all은 모든 캐릭터셋을 설치한다.




STEP 3.

configure 한 것을 make 와 make install을 한다.

[root@Cacti mysql-5.0.75]# make && make install
...... 이것 역시 길어서 생략 .......
test -z "/usr/local/server/mysql/share/mysql" || mkdir -p -- "/usr/local/server/mysql/share/mysql"
 /usr/bin/install -c 'mysql.server' '/usr/local/server/mysql/share/mysql/mysql.server'
 /usr/bin/install -c 'mysqld_multi.server' '/usr/local/server/mysql/share/mysql/mysqld_multi.server'
make[4]: Leaving directory `/download/mysql-5.0.75/support-files'
make[3]: Leaving directory `/download/mysql-5.0.75/support-files'
make[2]: Leaving directory `/download/mysql-5.0.75/support-files'
Making install in server-tools
make[2]: Entering directory `/download/mysql-5.0.75/server-tools'
Making install in instance-manager
make[3]: Entering directory `/download/mysql-5.0.75/server-tools/instance-manager'
make[4]: Entering directory `/download/mysql-5.0.75/server-tools/instance-manager'
test -z "/usr/local/server/mysql/libexec" || mkdir -p -- "/usr/local/server/mysql/libexec"
  /bin/sh ../../libtool --preserve-dup-deps --mode=install /usr/bin/install -c 'mysqlmanager' '/usr/local/server/mysql/libexec/mysqlmanager'
/usr/bin/install -c mysqlmanager /usr/local/server/mysql/libexec/mysqlmanager
make[4]: Nothing to be done for `install-data-am'.
make[4]: Leaving directory `/download/mysql-5.0.75/server-tools/instance-manager'
make[3]: Leaving directory `/download/mysql-5.0.75/server-tools/instance-manager'
make[3]: Entering directory `/download/mysql-5.0.75/server-tools'
make[4]: Entering directory `/download/mysql-5.0.75/server-tools'
make[4]: Nothing to be done for `install-exec-am'.
make[4]: Nothing to be done for `install-data-am'.
make[4]: Leaving directory `/download/mysql-5.0.75/server-tools'
make[3]: Leaving directory `/download/mysql-5.0.75/server-tools'
make[2]: Leaving directory `/download/mysql-5.0.75/server-tools'
make[1]: Leaving directory `/download/mysql-5.0.75'

[root@Cacti mysql-5.0.75]#




STEP 4.

MySQL에서 사용할 환경 설정 파일을 /etc에 복사를 한다.
my-huge.cnf : 메모리가 1G-2G 사이 일 때
my-large.cnf : 메모리가 512M 일 때
my-medium.cnf : 64~256M 사이 일 때
my-small.cnf : 메모리가 64보다 작을 때 사용한다.

[root@Cacti mysql-5.0.75]# cp support-files/my-huge.cnf /etc/my.cnf
[root@Cacti mysql-5.0.75]#




STEP 5.

MySQL을 관리 할 데이터베이스를 생성한다.

[root@Cacti mysql-5.0.75]# cd /usr/local/server/mysql/
[root@Cacti mysql]# ls
bin  include  info  lib  libexec  man  mysql-test  share  sql-bench
[root@Cacti mysql]# bin/mysql_install_db --user=mysql
Installing MySQL system tables...
090213 15:51:06 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
090213 15:51:06 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
OK
Filling help tables...
090213 15:51:06 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
090213 15:51:06 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
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/server/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/server/mysql/bin/mysqladmin -u root -h Cacti password 'new-password'

Alternatively you can run:
/usr/local/server/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/server/mysql ; /usr/local/server/mysql/bin/mysqld_safe &

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

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

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@Cacti mysql]#




STEP 6.

MySQL이 설치 된 디렉토리 권한을 다시 설정한다.

[root@Cacti mysql]# chown -R root .
[root@Cacti mysql]# chown -R mysql var
[root@Cacti mysql]# chgrp -R mysql .
[root@Cacti mysql]#



STEP 7.

MySQL 명령어를 편하게 사용 할 수 있게 환경변수에 등록한다.

[root@Cacti mysql]# vi ~/.bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/usr/local/server/mysql/bin

export PATH
unset USERNAME




다음 번에 다시 로그인 할 때 환경변수는 적용 된다.

즉시 적용하고 싶다면 아래와 같은 명령어를 써 준다.

[root@Cacti mysql]# source ~/.bash_profile
[root@Cacti mysql]#




STEP 8.

chkconfig를 이용하여 재부팅이 되어도 MySQL이 자동으로 실행 될 수 있게 설정한다.

[root@Cacti mysql]# cp share/mysql/mysql.server /etc/init.d/mysqld
[root@Cacti mysql]# chkconfig --add mysqld
[root@Cacti mysql]#


등록 된 것을 확인 해 본다.

[root@Cacti mysql]# chkconfig --list | grep mysqld
mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@Cacti mysql]#




STEP 9.

처음으로 MySQL을 실행하면 root의 암호를 설정해야 한다.

암호 설정 후 MySQL을 실행시키면 된다.

[root@Cacti mysql]# /etc/init.d/mysqld start
Starting MySQL.                                            [  OK  ]
[root@Cacti mysql]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.75-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> exit
Bye
[root@Cacti mysql]#

MySQL을 실행하고 exit로 빠져 나오는 과정을 보았다.


이제 MySQL의 root 암호를 설정해 보자.

[root@Cacti mysql]# mysqladmin -u root password 루트패스워드입력
[root@Cacti mysql]#


MySQL을 실행하면 암호가 설정되어서 MySQL을 사용 할 수 없다.

[root@Cacti mysql]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@Cacti mysql]#


[root@Cacti mysql]# mysql -u root -p
Enter password: 루트패스워드입력
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.75-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>



MySQL이 설치가 되었다.

블로그 이미지

쭈꾸댕이

아직 어설픈 실력으로 나름 제가 하는 것에 대한 것들을 옮기는 공간입니다. 틀린 부분도 있을 수 있으니 이 점 양해하시고, 도움이 되셨으면 좋겠네요.

,