리눅스 MySQL 최신버전 설치

리눅스 MySQL 최신 버전 설치

1 리눅스 확인[ | ]

설치할 서버의 리눅스 종류와 비트를 확인해보자.

[root@zetawiki ~]# cat /etc/issue
CentOS release 6.3 (Final)
Kernel \r on an \m
[root@zetawiki ~]# getconf LONG_BIT
64
→ CentOS 6.3이고 64비트이다.

2 다운로드[ | ]

  • 웹브라우저에서 http://dev.mysql.com/downloads/mysql/ 접속
  • Select Platform: Red Hat Enterprise Linux / Oracle Linux 선택[1]
  • Red Hat Enterprise Linux 6 / Oracle Linux 6 (x86, 64-bit), RPM Package MySQL Server 오른쪽에 있는 [Download] 클릭
  • 로그인 (계정 없으면 가입)
  • [Download Now » ] 클릭하여 MySQL-server-5.6.17-1.el6.x86_64.rpm 다운로드 (52.1MB)
  • 다시 http://dev.mysql.com/downloads/mysql/ 로 이동
  • Select Platform: Red Hat Enterprise Linux / Oracle Linux 선택[1]
  • Red Hat Enterprise Linux 6 / Oracle Linux 6 (x86, 64-bit), RPM Package Client Utilities 오른쪽에 있는 [Download] 클릭하여 MySQL-client-5.6.17-1.el6.x86_64.rpm 다운로드 (17.7MB)

3 파일 업로드[ | ]

  • rpm 파일들을 대상 서버에 업로드
[root@zetawiki ~]# ll *.rpm -h
-rw-r--r--. 1 root root 18M Apr 19 01:08 MySQL-client-5.6.17-1.el6.x86_64.rpm
-rw-r--r--. 1 root root 53M Apr 19 00:51 MySQL-server-5.6.17-1.el6.x86_64.rpm

4 서버 설치 1 (실패)[ | ]

[root@zetawiki ~]# yum install MySQL-server-5.6.17-1.el6.x86_64.rpm 
... (생략)
==========================================================================================
 Package          Arch       Version          Repository                             Size
==========================================================================================
Installing:
 MySQL-server     x86_64     5.6.17-1.el6     /MySQL-server-5.6.17-1.el6.x86_64     233 M

Transaction Summary
==========================================================================================
Install       1 Package(s)

Total size: 233 M
Installed size: 233 M
Is this ok [y/N]: y
... (생략)
  file /usr/share/mysql/charsets/swe7.xml from install of MySQL-server-5.6.17-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.61-4.el6.x86_64

Error Summary
-------------
→ 설치 실패. mysql-libs 패키지와 충돌이 있음
[root@zetawiki ~]# yum list installed | grep mysql-lib
mysql-libs.x86_64       5.1.61-4.el6    @anaconda-CentOS-201207061011.x86_64/6.3
→ CentOS 설치시에 설치된 패키지
→ 제거한다.
[root@zetawiki ~]# yum remove mysql-libs.x86_64
... (생략)
==========================================================================================
 Package        Arch   Version             Repository                                Size
==========================================================================================
Removing:
 mysql-libs     x86_64 5.1.61-4.el6        @anaconda-CentOS-201207061011.x86_64/6.3 4.0 M
Removing for dependencies:
 cronie         x86_64 1.4.4-7.el6         @anaconda-CentOS-201207061011.x86_64/6.3 166 k
 cronie-anacron x86_64 1.4.4-7.el6         @anaconda-CentOS-201207061011.x86_64/6.3  43 k
 crontabs       noarch 1.10-33.el6         @anaconda-CentOS-201207061011.x86_64/6.3 2.4 k
 postfix        x86_64 2:2.6.6-2.2.el6_1   @anaconda-CentOS-201207061011.x86_64/6.3 9.7 M
 sysstat        x86_64 9.0.4-20.el6        @anaconda-CentOS-201207061011.x86_64/6.3 807 k

Transaction Summary
==========================================================================================
Remove        6 Package(s)

Installed size: 15 M
Is this ok [y/N]: y
... (생략)
Removed:
  mysql-libs.x86_64 0:5.1.61-4.el6                                                        

Dependency Removed:
  cronie.x86_64 0:1.4.4-7.el6              cronie-anacron.x86_64 0:1.4.4-7.el6           
  crontabs.noarch 0:1.10-33.el6            postfix.x86_64 2:2.6.6-2.2.el6_1              
  sysstat.x86_64 0:9.0.4-20.el6           

Complete!

5 서버 설치 2 (성공)[ | ]

[root@zetawiki ~]# yum install MySQL-server-5.6.17-1.el6.x86_64.rpm 
... (생략)
==========================================================================================
 Package          Arch       Version          Repository                             Size
==========================================================================================
Installing:
 MySQL-server     x86_64     5.6.17-1.el6     /MySQL-server-5.6.17-1.el6.x86_64     233 M

Transaction Summary
==========================================================================================
Install       1 Package(s)

Total size: 233 M
Installed size: 233 M
Is this ok [y/N]: y
... (생략)
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

  /usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.
This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

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

New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

  Verifying  : MySQL-server-5.6.17-1.el6.x86_64                                       1/1 

Installed:
  MySQL-server.x86_64 0:5.6.17-1.el6                                                      

Complete!
→ 랜덤 패스워드 정보가 /root/.mysql_secret 에 있다고 한다. 기억해두자.

6 서비스 시작[ | ]

[root@zetawiki ~]# service mysql status
 ERROR! MySQL is not running
[root@zetawiki ~]# service mysql start
Starting MySQL... SUCCESS!
[root@zetawiki ~]# service mysql status
 SUCCESS! MySQL running (3528)
[root@zetawiki ~]# netstat -anp | grep mysql
tcp        0      0 :::3306                     :::*                        LISTEN      3528/mysqld         
unix  2      [ ACC ]     STREAM     LISTENING     37056  3528/mysqld         /var/lib/mysql/mysql.sock
→ 서비스가 작동중이며 3306 포트를 LISTEN하고 있다.

7 서비스 자동시작 확인[ | ]

[root@zetawiki ~]# chkconfig --list mysql
mysql          	0:off	1:off	2:on	3:on	4:on	5:on	6:off
→ 리눅스 부팅시에 MySQL 서비스가 자동 시작하도록 설정되어 있다.

8 클라이언트 설치[ | ]

[root@zetawiki ~]# yum install MySQL-client-5.6.17-1.el6.x86_64.rpm 
... (생략)
==========================================================================================
 Package          Arch       Version          Repository                             Size
==========================================================================================
Installing:
 MySQL-client     x86_64     5.6.17-1.el6     /MySQL-client-5.6.17-1.el6.x86_64      82 M

Transaction Summary
==========================================================================================
Install       1 Package(s)

Total size: 82 M
Installed size: 82 M
Is this ok [y/N]: y
... (생략)
Installed:
  MySQL-client.x86_64 0:5.6.17-1.el6                                                      

Complete!

9 패스워드 변경[ | ]

서버 설치시에 생성된 랜덤 패스워드를 확인하고 원하는 패스워드로 변경한다.

[root@zetawiki ~]# cat /root/.mysql_secret
# The random password set for the root user at Sat Apr 19 00:59:53 2014 (local time): KsoIfMYlfM6EQGUT
→ root 패스워드는 KsoIfMYlfM6EQGUT
[root@zetawiki ~]# mysqladmin -u root -pKsoIfMYlfM6EQGUT password MyNewP@ssw0rd
Warning: Using a password on the command line interface can be insecure.
→ root 패스워드가 MyNewP@ssw0rd로 변경되었음

10 로컬 로그인[ | ]

[root@zetawiki ~]# mysql -uroot -pMyNewP@ssw0rd
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.17

Copyright (c) 2000, 2014, 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> quit
Bye

11 같이 보기[ | ]

12 주석[ | ]

  1. 1.0 1.1 설치할 서버에 맞는 것으로 선택한다. Debian, SuSE 등이 있다. 여기서는 CentOS가 레드햇 계열이므로 이것을 선택했다.
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}