"리눅스 MySQL 최신버전 설치"의 두 판 사이의 차이

잔글 (봇: Jmnote bot의 2016-03-29T03:13:23Z 에 작성한 181844 판으로 되돌림)
잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
6번째 줄: 6번째 줄:
{{참고|리눅스 비트 확인}}
{{참고|리눅스 비트 확인}}
설치할 서버의 리눅스 종류와 비트를 확인해보자.
설치할 서버의 리눅스 종류와 비트를 확인해보자.
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# cat /etc/issue
[root@zetawiki ~]# cat /etc/issue
CentOS release 6.3 (Final)
CentOS release 6.3 (Final)
Kernel \r on an \m
Kernel \r on an \m
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# getconf LONG_BIT
[root@zetawiki ~]# getconf LONG_BIT
64
64
</source>
</syntaxhighlight>
:→ CentOS 6.3이고 64비트이다.
:→ CentOS 6.3이고 64비트이다.


29번째 줄: 29번째 줄:
==파일 업로드==
==파일 업로드==
*rpm 파일들을 대상 서버에 업로드
*rpm 파일들을 대상 서버에 업로드
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# ll *.rpm -h
[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 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
-rw-r--r--. 1 root root 53M Apr 19 00:51 MySQL-server-5.6.17-1.el6.x86_64.rpm
</source>
</syntaxhighlight>


==서버 설치 1 (실패)==
==서버 설치 1 (실패)==
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# yum install MySQL-server-5.6.17-1.el6.x86_64.rpm  
[root@zetawiki ~]# yum install MySQL-server-5.6.17-1.el6.x86_64.rpm  
... (생략)
... (생략)
52번째 줄: 52번째 줄:
Installed size: 233 M
Installed size: 233 M
Is this ok [y/N]: y
Is this ok [y/N]: y
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
... (생략)
... (생략)
   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
   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
59번째 줄: 59번째 줄:
Error Summary
Error Summary
-------------
-------------
</source>
</syntaxhighlight>
:→ 설치 실패. mysql-libs 패키지와 충돌이 있음
:→ 설치 실패. mysql-libs 패키지와 충돌이 있음
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# yum list installed | grep mysql-lib
[root@zetawiki ~]# yum list installed | grep mysql-lib
mysql-libs.x86_64      5.1.61-4.el6    @anaconda-CentOS-201207061011.x86_64/6.3
mysql-libs.x86_64      5.1.61-4.el6    @anaconda-CentOS-201207061011.x86_64/6.3
</source>
</syntaxhighlight>
:→ CentOS 설치시에 설치된 패키지
:→ CentOS 설치시에 설치된 패키지
:→ 제거한다.
:→ 제거한다.
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# yum remove mysql-libs.x86_64
[root@zetawiki ~]# yum remove mysql-libs.x86_64
... (생략)
... (생략)
88번째 줄: 88번째 줄:
Installed size: 15 M
Installed size: 15 M
Is this ok [y/N]: y
Is this ok [y/N]: y
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
... (생략)
... (생략)
Removed:
Removed:
100번째 줄: 100번째 줄:


Complete!
Complete!
</source>
</syntaxhighlight>


==서버 설치 2 (성공)==
==서버 설치 2 (성공)==
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# yum install MySQL-server-5.6.17-1.el6.x86_64.rpm  
[root@zetawiki ~]# yum install MySQL-server-5.6.17-1.el6.x86_64.rpm  
... (생략)
... (생략)
119번째 줄: 119번째 줄:
Installed size: 233 M
Installed size: 233 M
Is this ok [y/N]: y
Is this ok [y/N]: y
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
... (생략)
... (생략)
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
158번째 줄: 158번째 줄:


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


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


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


==클라이언트 설치==
==클라이언트 설치==
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# yum install MySQL-client-5.6.17-1.el6.x86_64.rpm  
[root@zetawiki ~]# yum install MySQL-client-5.6.17-1.el6.x86_64.rpm  
... (생략)
... (생략)
205번째 줄: 205번째 줄:
Installed size: 82 M
Installed size: 82 M
Is this ok [y/N]: y
Is this ok [y/N]: y
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
... (생략)
... (생략)
Installed:
Installed:
212번째 줄: 212번째 줄:


Complete!
Complete!
</source>
</syntaxhighlight>


==패스워드 변경==
==패스워드 변경==
서버 설치시에 생성된 랜덤 패스워드를 확인하고 원하는 패스워드로 변경한다.
서버 설치시에 생성된 랜덤 패스워드를 확인하고 원하는 패스워드로 변경한다.
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# cat /root/.mysql_secret
[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
# The random password set for the root user at Sat Apr 19 00:59:53 2014 (local time): KsoIfMYlfM6EQGUT
</source>
</syntaxhighlight>
:→ root 패스워드는 KsoIfMYlfM6EQGUT
:→ root 패스워드는 KsoIfMYlfM6EQGUT
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# mysqladmin -u root -pKsoIfMYlfM6EQGUT password MyNewP@ssw0rd
[root@zetawiki ~]# mysqladmin -u root -pKsoIfMYlfM6EQGUT password MyNewP@ssw0rd
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
</source>
</syntaxhighlight>
:→ root 패스워드가 MyNewP@ssw0rd로 변경되었음
:→ root 패스워드가 MyNewP@ssw0rd로 변경되었음


==로컬 로그인==
==로컬 로그인==
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# mysql -uroot -pMyNewP@ssw0rd
[root@zetawiki ~]# mysql -uroot -pMyNewP@ssw0rd
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
245번째 줄: 245번째 줄:
mysql> quit
mysql> quit
Bye
Bye
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 11월 2일 (월) 00:56 기준 최신판

리눅스 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 }}