티스토리 뷰

728x90

필요한 라이브러리 설치

sudo apt-get install gcc g++ libncurses5-dev libxml2-dev openssl libssl-dev curl libcurl4-openssl-dev libjpeg-dev libpng-dev libfreetype6-dev libsasl2-dev autoconf libncurses5-dev

다운로드

wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.3-m3.tar.gz/from/http://mysql.he.net/

MySQL 계정 만들기

sudo groupadd mysql
sudo useradd -g mysql mysql
sudo passwd mysql
sudo mkdir /home/mysql
sudo chown mysql:mysql /home/mysql
tar zxvf mysql-5.5.3-m3.tar.gz
cd mysql-5.5.3-m3/

cmake 설치

$ sudo apt-get install cmake

MySQL 소스 컴파일

./configure --prefix=/usr/local/mysql --localstatedir=/data/mysql/data --enable-assembler --enable-static --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock --without-innodb --without-isam --without-ndb-debug --without-debug --with-big-tables --with-extra-charsers=gbk,gb2312,utf8 --with-pthread --with-plugins=partition,innobase,myisammrg --with-charset=utf8 --with-readline

sudo make
sudo make install

디렉토리 생성

sudo mkdir -p /data/mysql/data/
sudo mkdir -p /data/mysql/log/
sudo mkdir /var/log/mysql
sudo chown mysql:mysql /var/log/mysql
sudo chmod 750 /var/log/mysql

my.cof 복사

참조 :
http://blog.naver.com/iamfreeman/50006780132
http://blog.dasom.pe.kr/35

sudo cp /usr/local/mysql/share/mysql/my-medium.cnf /data/mysql/my.cnf

디렉토리 권한 변경

sudo chown -R mysql:mysql /usr/local/mysql
sudo chown -R mysql:mysql /data/mysql/

MySQL Database 생성 
 
user1@ubuntu:~/mysql-5.5.3-m3$ sudo /usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql/data --user=mysql
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 ubuntu 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/scripts/mysqlbug script!

user1@ubuntu:~/mysql-5.5.3-m3$

부팅시 자동 시작 설정

sudo cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
sudo ln -s /etc/init.d/mysqld /etc/rc2.d/S99mysql
sudo ln -s /etc/init.d/mysqld /etc/rc2.d/K99mysql
sudo ln -s /etc/init.d/mysqld /etc/rc3.d/S99mysql
sudo ln -s /etc/init.d/mysqld /etc/rc3.d/K99mysql

mysqld 수정

sudo vi /etc/init.d/mysqld

1. parse_server_arguments 주석 처리 한다.
=> #parse_server_arguments

2. $bindir/mysqld_safe 수정

      #$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &

기존 내용은 주석으로 하고 아래와 같이 추가 한다.

      $bindir/mysqld_safe --defaults-file=/data/mysql/my.cnf 2>&1 > /dev/null &

재부팅

sudo sync
sudo sync
sudo init 6

실행확인

user1@ubuntu:~$ ps -ef | grep mysql
root      2506     1  0 12:09 pts/1    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysql/my.cnf
mysql     2738  2506  0 12:09 pts/1    00:00:00 /usr/local/mysql/libexec/mysqld --defaults-file=/data/mysql/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql/data --plugin-dir=/usr/local/mysql/lib/mysql/plugin --user=mysql --log-error=/data/mysql/data/ubuntu.err --pid-file=/data/mysql/data/ubuntu.pid --socket=/usr/local/mysql/tmp/mysql.sock --port=3306
user1     2751  2104  0 12:09 pts/1    00:00:00 grep --color=auto mysql

user1@ubuntu:~$

root 암호 설정

/usr/local/mysql/bin/mysqladmin -u root password 'root!@' -S /usr/local/mysql/tmp/mysql.sock

MySQL 외부에서 접속하기

user1@ubuntu:~$ /usr/local/mysql/bin/mysql -u root -p -S /usr/local/mysql/tmp/mysql.sock
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.3-m3-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>  grant all privileges on *.* to root@'%';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql>

ssh 데몬 설치

sudo apt-get install openssh-server
sudo init 6 (재부팅)

MySQL - SQLGate로 SSH 터널링을 통해 연결하기

댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
글 보관함