1. 다운로드
http://dev.mysql.com/downloads -> MySQL Community Server -> Source Code -> Generic Linux (Architecture Independent), Compressed TAR Archive 선택

# wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.49.tar.gz/from/http://mirror.khlug.org/mysql/


2. 압축풀기

# tar -xvzf mysql-5.1.49.tar.gz
# mv mysql-5.1.49 mysql

# cd mysql

# ./configure 
--prefix=/usr/local/mysql2 
--enable-shared  
--with-charset=utf8 
--localstatedir=/usr/local/mysql2/data 
--sysconfdir=/usr/local/mysql2 
--with-innodb 
또는
# ./configure 
--prefix=/usr/local/mysql2 
--localstatedir=/usr/local/mysql2/data 
--with-unix-socket-path=/usr/local/mysql2/mysql2.sock 
--with-tcp-port=3307 
--with-charset=utf8  
--enable-shared  
--with-innodb 

# make

# make install

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

# chown -R mysql:mysql /usr/local/mysql2/data


my-huge.cnf : 1GB 이상 메모리
my-large.cnf : 512MB ~ 1GB
my-medium.cnf : 128MB ~ 256MB
my-small.cnf : 64MB 이하

# vi /usr/local/mysql2/my.cnf 

[client] 
port = 3307 
socket = /usr/local/mysql2/mysql2.sock 

[mysqld] 
port = 3307 
socket = /usr/local/mysql2/mysql2.sock 

# /usr/local/mysql2/bin/mysql_install_db 
# chown -R mysql.mysql /usr/local/mysql2

 

3. 시작

# /usr/local/mysql2/bin/mysqld_safe --defaults-file=/usr/local/mysql2/my.cnf &

또는

# /usr/local/mysql2/bin/mysqld_safe --user=root --socket=/usr/local/mysql2/mysql2.sock --port=3307 &

또는

# /usr/local/mysql2/share/mysql/mysql.server start

 

4. 접속

# /usr/local/mysql2/bin/mysqladmin -u root password "암호"
# /usr/local/mysql2/bin/mysql -u root -p

 

5. 종료

# /usr/local/mysql2/bin/mysqladmin -u root -p shutdown