본문 바로가기

DATABASE

[mySQL] RHEL5에서 mysql설치

mysql계정 생성

[root@devcais13 install]# groupadd mysql
[root@devcais13 install]# useradd -g mysql mysql
useradd -M -c Mysql_server -d /var/lib/mysql -g mysql -s /bin/bash mysql
결과=> mysql:x:503:504:Mysql_server:/var/lib/mysql:/bin/bash
설명 : mysql의 홈디렉토리를 data가 위치하는곳으로 위치시키고 -M옵션으로 홈디렉토리에 불필요한것이 없게 한다.


Rpm으로 mysql설치 but error (perl)

[root@devcais13 install]# rpm -ivh MySQL-server-community-5.0.45-0.rhel5.i386.rpm
오류: Failed dependencies:
perl(DBI) is needed by MySQL-server-community-5.0.45-0.rhel5.i386

해결 : yum으로 perl모듈을 설치

yum list | grep perl
perl-DBD-MySQL.x86_64 3.0007-1.fc6 rhel-x86_64-serv
perl-DBD-Pg.x86_64 1.49-1.fc6 rhel-x86_64-serv
perl-DBI.x86_64 1.52-1.fc6 rhel-x86_64-serv

yum install perl-DBI.x86_64

[root@devcais13 install]# rpm -ivh MySQL-server-community-5.0.45-0.rhel5.i386.rpm
준비 중... ########################################### [100%]
1:MySQL-server-community ########################################### [100%]
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h devcais13.kaist.ac.kr password 'new-password'
See the manual for more instructions.
Please report any problems with the /usr/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
Starting MySQL[ OK ]
Giving mysqld 2 seconds to start
[root@devcais13 install]#

[root@devcais13 install]# rpm -ivh MySQL-client-community-5.0.45-0.rhel5.i386.rpm
준비 중... ########################################### [100%]
1:MySQL-client-community ########################################### [100%]

설치끝.


설치후 root패스워드변경

[root@devcais13 install]# /usr/bin/mysqladmin -u root password 'xxx'
[root@devcais13 install]# /usr/bin/mysqladmin -u root -h devcais13.kaist.ac.kr password 'xxx'
[root@devcais13 install]# mysql -u root -p
Enter password:
mysql 로그인 성공. 짝짝짝 !


my.cnf복사

/usr/share/mysql/my-medium.cnf 파일을 /etc/my.cnf 로 복사해 준다. 이것은 서버와 클라이언트, 그리고 MySQL패키지와 관련된 모든 어플리케이션의 설정을 가지고 있다. 일단은 기본적인 것을 사용하면 된다.


character set변경(latin1 -> utf8)

최초 설치시에는 latin1으로 되어있다.
mysql> show variables like 'c%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
| collation_connection | latin1_swedish_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
| completion_type | 0 |
| concurrent_insert | 1 |
| connect_timeout | 5 |
+--------------------------+----------------------------+

/etc/my.cnf를 수정 (아래 부분을 추가해 넣으면 됨)

[client]
default-character-set=utf8

[mysqld]
init_connect=SET collation_connection=utf8_general_ci
init_connect=SET NAMES utf8
default-character-set=utf8
character-set-server=utf8
collation-server=utf8_general_ci

서버 재시작
shutdown : mysqladmin -uroot -p패스워드 shutdown
start : mysqld_safe &

변경된 character set 확인

mysql> show variables like 'c%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
| completion_type | 0 |
| concurrent_insert | 1 |
| connect_timeout | 5 |
+--------------------------+----------------------------+

> mysql -u root mysql

mysql> grant all privileges on *.* to teamtask@localhost identified by 'my_password' WITH GRANT OPTION;

mysql> grant all privileges on *.* to teamtask@'퍼센트' identified by 'my_password' WITH GRANT OPTION;

'DATABASE' 카테고리의 다른 글

[MySQL] Database backup  (0) 2011.10.16
[MySQL] 외부접속  (0) 2011.10.16
[ORACLE] 오라클 시간계산  (0) 2011.10.16
[MySQL] Linux에서 5.0 설치하기 - 컴파일  (0) 2011.10.16
[oracle] 10g에서 생긴 쓰레기통 삭제 방법  (0) 2011.10.16