Mysql binary install


Mysql binary install 버전 설치시 정보이다.


일반적으로 압축 파일을 풀면 INSTALL-BINARY 파일 정보를 확인하면 된다
단 모두 영어로 되어 있기에 리딩으로 잘 하면된다

파일 압축 해제 > binary 스크립토 동작 > 환경 파일 복사 > mysql 기동 > 데몬 등록 > root 암호 변경 이런 설정으로 이루어 지면

기본 Mysql Charaterset은 latin1 이다

이하는  INSTALL-BINARY 설치 순서를 실행해본 결과이다.



# Mysql Install
INSTALL-BINARY file 참조

# check disk partition info

[nexmore@nexsms /]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
50G  3.7G   44G   8% /
tmpfs                1001M  436K 1001M   1% /dev/shm
/dev/sda1             485M   28M  432M   7% /boot
/dev/mapper/VolGroup-lv_home
                       81G  221M   76G   1% /home


# Make a group and a account
shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local

# Copy mysql path into the binary file
Exam ] shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> cd /home/mysql
shell> tar zxvf mysql-advanced-5.5.21-linux2.6-i686.tar.gz

# Make mysql symbolink
Exam] shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> ln -s /home/mysql/mysql-advanced-5.5.21-linux2.6-i686 mysql

shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .

# Install mysql binary file
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data

# Next command is optional / setting parameter file
shell> cp support-files/my-medium.cnf /etc/my.cnf

# mysql start
shell> bin/mysqld_safe --user=mysql &

# Next command is optional / setting startup file
shell> cp support-files/mysql.server /etc/init.d/mysql.server

#Init mysql root password

[mysql@nexsms ~]$ mysql -u root mysql
mysql> update user set password=password('nex147200') where user = 'root';

mysql> flush privileges;


# show info

mysql> \s
--------------
mysql  Ver 14.14 Distrib 5.5.21, for linux2.6 (i686) using  EditLine wrapper

Connection id:          5
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.5.21-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial)
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /tmp/mysql.sock
Uptime:                 12 min 3 sec

Threads: 1  Questions: 14  Slow queries: 0  Opens: 33  Flush tables: 1  Open tables: 26  Queries per second avg: 0.019
--------------

# if change charterset
mysql> SET character_set_client = euckr;
mysql> SET character_set_results = euckr;
mysql> SET character_set_connection = euckr;
mysql> ALTER DATABASE [DB명] DEFAULT CHARACTER SET euckr;
commit;



# check CHARACTER SET and COLLATION
show CHARACTER SET;
show COLLATION;
show COLLATION like 'euckr%';

# setting Charater Info
\s
Server characterset:    latin1
Db     characterset:    euckr
Client characterset:    utf8
Conn.  characterset:    utf8

> 초기 connection 시 euckr 로 되게 설정
>> my.cnf 파일을 수정하며, 해당 작업으로 client tool에서 한글 깨짐을 해결한다.

[mysql]
default-character-set = euckr

[client]
default-character-set = euckr

[mysqld]
character-set-client-handshake=FALSE
init_connect="SET collation_connection = euckr_korean_ci"
init_connect="SET NAMES euckr"
character-set-server = euckr
collation-server = euckr_korean_ci

[mysqldump]
default-character-set = euckr


# check CHARACTER SET and COLLATION
http://dev.mysql.com/doc/refman/5.0/en/charset-database.html


# check CHARACTER SET and COLLATION
show CHARACTER SET;
show COLLATION;
show COLLATION like 'euckr%';


# Add DataBase
CREATE DATABASE smsdb DEFAULT CHARACTER SET euckr DEFAULT COLLATE euckr_korean_ci;
drop DATABASE smsdb cascade;


# Add user ?
> 기본 계정 생성
CREATE USER 'nexsms'@'%.%.%.%' identified by 'nex147200';
> 로컬과 외부 서버에서 접근 관련 권한 설정
GRANT all privileges ON nexsmsdb.* TO 'nexsms'@'%.%.%.%' identified by 'nex147200' with grant option;
GRANT all privileges ON nexsmsdb.* TO 'nexsms'@'localhost' identified by 'nex147200' with grant option;
GRANT all privileges ON nexsmsdb.* TO 'nexsms'@'127.0.0.1' identified by 'nex147200' with grant option;

flush privileges;

# Drop user
use mysql
select host, user from user;

drop user 'nexsms'@'%.%.%.%';
drop user 'nexsms'@'localhost';
drop user 'nexsms'@'127.0.0.1';

flush privileges;

# 외부 IP 설정

ㄱ. 개요
  MySql 서버 업그레이드 후 원격호스트에서 접속이 불가한 경우 my.cnf 파일에
  bind-address 설정으로 해결될 수 있습니다.

ㄴ. bind-address 설정
가. /etc/my.cnf 파일을 vi 에디터로 편집합니다.

[mysqld]
~
#bind-address = 221.146.159.167           # 해당사항 왼쪽과 같이 주석 처리

ㄷ. 외부 접근 확인
mysql -h 221.146.159.167 -u nexsms -p nexsmsdb

# 대소문자 설정
my.cnf
[mysqld] 하단에 수정

lower_case_table_names=1

# Can not drop Database

MySQL: ERROR 1010 (HY000): Error dropping database (can't rmdir './foodb', errno: 39)
The problem
mysql> drop database foodb;
ERROR 1010 (HY000): Error dropping database (can't rmdir './foodb', errno: 39)

The solution
# cd /var/lib/mysql
var/lib/mysql# ls
foodb
/var/lib/mysql# rm -fr foodb
mysql> drop database foodb;
ERROR 1008 (HY000): Can't drop database 'foodb'; database doesn't exist
mysql> create database foodb;
Query OK, 1 row affected (0.00 sec)
mysql> drop database foodb;
Query OK, 0 rows affected (3.38 sec)

댓글

이 블로그의 인기 게시물

CoreOS Vagrant on Windows.md

The Docker User Guide

Install Docker