리눅스 MySQL 최신버전 설치

리눅스 MySQL 최신 버전 설치

1 리눅스 확인[ | ]

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

Console
Copy
[root@zetawiki ~]# cat /etc/issue
CentOS release 6.3 (Final)
Kernel \r on an \m
Console
Copy
[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 파일들을 대상 서버에 업로드
Console
Copy
[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 (실패)[ | ]

Console
Copy
[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
Console
Copy
... (생략)
  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 패키지와 충돌이 있음
Console
Copy
[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 설치시에 설치된 패키지
→ 제거한다.
Console
Copy
[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
Console
Copy
... (생략)
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 (성공)[ | ]

Console
Copy
[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
Console
Copy
... (생략)
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 서비스 시작[ | ]

Console
Copy
[root@zetawiki ~]# service mysql status
 ERROR! MySQL is not running
Console
Copy
[root@zetawiki ~]# service mysql start
Starting MySQL... SUCCESS!
Console
Copy
[root@zetawiki ~]# service mysql status
 SUCCESS! MySQL running (3528)
Console
Copy
[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 서비스 자동시작 확인[ | ]

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

8 클라이언트 설치[ | ]

Console
Copy
[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
Console
Copy
... (생략)
Installed:
  MySQL-client.x86_64 0:5.6.17-1.el6                                                      

Complete!

9 패스워드 변경[ | ]

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

Console
Copy
[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
Console
Copy
[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 로컬 로그인[ | ]

Console
Copy
[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가 레드햇 계열이므로 이것을 선택했다.
  • CentOS MySQL 설치
    RHEL5.x 버전에서 MySQL-5.5.45 버전 설치시, /usr/bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data 와 같이 설정해 주지 않으면 정상 동작하지 않는 경우가 있었습니다. 확인 바랍니다.
  • MySQL BigDump
    'MySQL server has gone away'는 백업본 전체의 크기가 크다기 보다는, 특정 쿼리문 1개의 크기가 너무 커서 처리를 못하는 거라서, 이런 도구로 해결하기는 어려울 것 같습니다.J Jmnote
  • MySQL STRICT TRANS TABLES
    @Jmnote 감사합니다.~ John Jeong
  • MySQL 외래키 옵션 변경
    진짜 필요한 거였는데 이런걸 이제야 알다니 정말 감사합니다. 문태부
  • MySQL 컬럼명으로 테이블 찾기
    회사 가서 쓰기 좋은 코드 1추 Stly3466