1. 다운로드(mysql-5.5.12-win32.zip)
http://dev.mysql.com/downloads/mysql/5.5.html

2. 압축풀기
압축폴더 : C:\mysql\mysql-5.5.12-win32

3. mysql.ini 파일 작성
경로 : C:\mysql\mysql-5.5.12-win32\mysql.ini
----------------------------------------------------
[mysqld]
port=2233
basedir=C:\mysql\mysql-5.5.12-win32
datadir=C:\mysql\mysql-5.5.12-win32\data
character-set-server=utf8
collation-server=utf8_general_ci

[mysql]
default-character-set=utf8

[client]
default-character-set=utf8
----------------------------------------------------

4. MySQL 서버 NT 서비스에 등록
- 명령 프롬프트 관리자 권한으로 실행

---------------------------------------------------- 
C:\Windows\system32>cd C:\mysql\mysql-5.5.12-win32

C:\mysql\mysql-5.5.12-win32>bin\mysqld.exe --install "MySQL 5.5.12" --defaults-file=C:\mysql\mysql-5.5.12-win32\mysql.ini
Service successfully installed.
----------------------------------------------------



5. 서비스 시작하기

----------------------------------------------------
C:\mysql\mysql-5.5.12-win32>net start "MySQL 5.5.12"
MySQL 5.5.12 서비스를 시작합니다..
MySQL 5.5.12 서비스가 잘 시작되었습니다.
----------------------------------------------------

6. 데이터베이스 접속

----------------------------------------------------
mysql -h localhost -u root -P 2233
----------------------------------------------------

7. 데이터베이스 생성

----------------------------------------------------
mysql> create database db_test;
Query OK, 1 row affected (0.00 sec)
----------------------------------------------------

8. 사용자 추가

----------------------------------------------------
mysql> use mysql;
Database changed
mysql> create user 'test'@'%' identified by 'test00';
Query OK, 0 rows affected (0.00 sec)

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

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql>
----------------------------------------------------

JDBC 접속 테스트

----------------------------------------------------
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class JDBCConnectTest {

 public static void main(String[] args) throws Exception {
  Connection conn = null;
  
  String jdbc_driver = "org.gjt.mm.mysql.Driver";
  String jdbc_url = "jdbc:mysql://192.168.0.62:2233/db_test";
  
  try {
   Class.forName(jdbc_driver);
   conn = DriverManager.getConnection(jdbc_url, "test", "test00");
   System.out.println(conn);   
   conn.close();
  } catch (SQLException e) {
   e.printStackTrace();
  }
 }
}
----------------------------------------------------

NT 서비스 지우기
- 명령 프롬프트 관리자 권한으로 실행

----------------------------------------------------
C:\mysql\mysql-5.5.12-win32>bin\mysqld.exe --remove "MySQL 5.5.12"
Service successfully removed.
----------------------------------------------------

신고

쿠분투(우분투) 10.04 / MySQL 5.5 컴파일/설치/데몬

OS/Linux 2010.07.11 11:56 Posted by 파란크리스마스

필요한 라이브러리 설치

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 터널링을 통해 연결하기

신고


 

티스토리 툴바