MySQL 버전별 RPM 설치하기

MySQL community server 레포지토리 등록

http://dev.mysql.com/downloads/repo/yum/ 를 방문해 자신의 OS에 맞는 패키지를 받아 설치한다.

본 내용에서는 CentOS 6을 기준으로 설명하겠다.

레포지토리 설치

centos 6

# wget http://dev.mysql.com/get/mysql57-community-release-el6-8.noarch.rpm
# rpm -Uvh mysql57-community-release-el6-8.noarch.rpm

centos 7

# wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
# rpm -Uvh mysql57-community-release-el7-8.noarch.rpm

MySQL 설치

레포지토리 확인

다음과 같이 yum repolist 명령으로 MySQL의 어떤버전의 레포지토리가 활성화 되어있는지 확인하고, 현재 mysql57-community 레포지토리가 활성화 되어 있으니 그냥 설치하게 되면 mysql 5.7 버전이 설치되게 된다.

# yum repolist enabled | grep mysql
mysql-connectors-community MySQL Connectors Community                         21
mysql-tools-community      MySQL Tools Community                              35
mysql57-community          MySQL 5.7 Community Server                         82

설치

# yum install mysql-community-server
# service mysqld start

버전 확인

/var/log/mysqld.log 파일을 열어 [Note] A temporary password is generated for root@localhost: vdke>!jte7gD 이 부분을 찾아 패스워드를 확인하여 접속한다.

# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.12 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>

패스워드 변경

mysql 5.7 부터는 최초 로그인 후 패스워드를 변경해 줘야 한다.

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Password';

MySQL 다른 버전 설치 하기

레포지토리 확인

아래 내용을 보면 mysql57-community 레포지토리가 활성화 되어 있는것을 확인 할 수 있다.

# yum repolist all | grep mysql
mysql-connectors-community        MySQL Connectors Community     enabled:     21
mysql-connectors-community-source MySQL Connectors Community - S disabled
mysql-tools-community             MySQL Tools Community          enabled:     35
mysql-tools-community-source      MySQL Tools Community - Source disabled
mysql-tools-preview               MySQL Tools Preview            disabled
mysql-tools-preview-source        MySQL Tools Preview - Source   disabled
mysql55-community                 MySQL 5.5 Community Server     disabled
mysql55-community-source          MySQL 5.5 Community Server - S disabled
mysql56-community                 MySQL 5.6 Community Server     disabled
mysql56-community-source          MySQL 5.6 Community Server - S disabled
mysql57-community                 MySQL 5.7 Community Server     enabled:     82
mysql57-community-source          MySQL 5.7 Community Server - S disabled

레포지토리 변경

MySQL 5.6 을 설치하기 위해 yum-config-manager명령어로 레포지토리 변경을 해준다.
yum-config-manager명령어가 없으면 yum install yum-utils로 설치한다.

### mysql57-community 레포지토리 비활성화
# yum-config-manager --disable mysql57-community
### mysql56-community 레포지토리 활성화
# yum-config-manager --enable mysql56-community

변경된 레포지토리 확인

# yum repolist enabled | grep mysql
mysql-connectors-community MySQL Connectors Community                         21
mysql-tools-community      MySQL Tools Community                              35
mysql56-community          MySQL 5.6 Community Server                        248

설치

# yum install mysql-community-server
# service mysqld start

버전 확인

# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.30 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>

One thought on “MySQL 버전별 RPM 설치하기

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다