2018.11.22 21:10

CentOS7에서 MySQL 8 설치하기

MySQL8.x 버전은 PHP7.x에서 작동하므로 주의해야 한다. MySQL8을 사용하기 위해서 PHP 버전을 확인해 보자.


○ MySQL 8.x 설치를 위한 준비 작업

]# rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm

https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm /var/tmp/rpm-tmp.5kLLuY: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY ######################### [100%]

Updating / installing...  1:mysql80-community-release-el7-1  ####################### [100%]


]# yum repolist all | grep mysql | grep enabled

mysql-connectors-community/x86_64  MySQL Connectors Community    enabled:     74

mysql-tools-community/x86_64       MySQL Tools Community         enabled:     74

mysql80-community/x86_64           MySQL 8.0 Community Server    enabled:     49




○ MySQL 설치하기

]# yum -y install mysql-community-server

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: ftp.neowiz.com

 * epel: mirror.premi.st

 * extras: ftp.neowiz.com

 * updates: ftp.neowiz.com

 * webtatic: sp.repo.webtatic.com

Resolving Dependencies

--> Running transaction check

---> Package mysql-community-server.x86_64 0:8.0.13-1.el7 will be installed

--> Processing Dependency: mysql-community-common(x86-64) = 8.0.13-1.el7 for package: mysql-community-server-8.0.13-1.el7.x86_64

--> Processing Dependency: mysql-community-client(x86-64) >= 8.0.0 for package: mysql-community-server-8.0.13-1.el7.x86_64

--> Running transaction check

---> Package mysql-community-client.x86_64 0:8.0.13-1.el7 will be installed

--> Processing Dependency: mysql-community-libs(x86-64) >= 8.0.0 for package: mysql-community-client-8.0.13-1.el7.x86_64

---> Package mysql-community-common.x86_64 0:8.0.13-1.el7 will be installed

--> Running transaction check

---> Package mariadb-libs.x86_64 1:5.5.60-1.el7_5 will be obsoleted

--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64

--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: php71w-mysql-7.1.23-1.w7.x86_64

--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64

--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: php71w-mysql-7.1.23-1.w7.x86_64

---> Package mysql-community-libs.x86_64 0:8.0.13-1.el7 will be obsoleting

--> Running transaction check

---> Package mysql-community-libs-compat.x86_64 0:8.0.13-1.el7 will be obsoleting

--> Finished Dependency Resolution


Dependencies Resolved


===============================================================

 Package                                   Arch                 Version                       Repository                       Size

====================================================================Installing:

 mysql-community-libs                      x86_64               8.0.13-1.el7                  mysql80-community               2.3 M

     replacing  mariadb-libs.x86_64 1:5.5.60-1.el7_5

 mysql-community-libs-compat               x86_64               8.0.13-1.el7                  mysql80-community               2.1 M

     replacing  mariadb-libs.x86_64 1:5.5.60-1.el7_5

 mysql-community-server                    x86_64               8.0.13-1.el7                  mysql80-community               381 M

Installing for dependencies:

 mysql-community-client                    x86_64               8.0.13-1.el7                  mysql80-community                26 M

 mysql-community-common                    x86_64               8.0.13-1.el7                  mysql80-community               554 k


Transaction Summary

================================================================

Install  3 Packages (+2 Dependent packages)


Total download size: 412 M

Downloading packages:

 /var/cache/yum/x86_64/7/mysql80-community/packages/mysql-community-common-8.0.13-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Public key for mysql-community-common-8.0.13-1.el7.x86_64.rpm is not installed

(1/5): mysql-community-common-8.0.13-1.el7.x86_64.rpm                                                        | 554 kB  00:00:01     

(2/5): mysql-community-libs-8.0.13-1.el7.x86_64.rpm                                                          | 2.3 MB  00:00:00     

(3/5): mysql-community-client-8.0.13-1.el7.x86_64.rpm                                                        |  26 MB  00:00:02     

(4/5): mysql-community-libs-compat-8.0.13-1.el7.x86_64.rpm                                                   | 2.1 MB  00:00:00     

(5/5): mysql-community-server-8.0.13-1.el7.x86_64.rpm                                                        | 381 MB  00:01:41     

--------------------------------------------------------------------------------------------------------------

Total                                                                                               4.0 MB/s | 412 MB  00:01:44     

Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

Importing GPG key 0x5072E1F5:

 Userid     : "MySQL Release Engineering <mysql-build@oss.oracle.com>"

 Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5

 Package    : mysql80-community-release-el7-1.noarch (installed)

 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Warning: RPMDB altered outside of yum.

  Installing : mysql-community-common-8.0.13-1.el7.x86_64                  1/6 

  Installing : mysql-community-libs-8.0.13-1.el7.x86_64                   2/6 

/sbin/ldconfig: /usr/lib/vmware-tools/lib64/libvmGuestLib.so/libvmGuestLib.so?

  Installing : mysql-community-client-8.0.13-1.el7.x86_64        3/6 

  Installing : mysql-community-server-8.0.13-1.el7.x86_64         4/6 

  Installing : mysql-community-libs-compat-8.0.13-1.el7.x86_64                5/6 

/sbin/ldconfig: /usr/lib/vmware-tools/lib64/libvmGuestLib.so/libvmGuestLib.so

  Erasing    : 1:mariadb-libs-5.5.60-1.el7_5.x86_64       6/6 

/sbin/ldconfig: /usr/lib/vmware-tools/lib64/libvmGuestLib.so/libvmGuestLib.so


  Verifying  : mysql-community-libs-compat-8.0.13-1.el7.x86_64               1/6 

  Verifying  : mysql-community-libs-8.0.13-1.el7.x86_64                       2/6 

  Verifying  : mysql-community-common-8.0.13-1.el7.x86_64                    3/6 

  Verifying  : mysql-community-server-8.0.13-1.el7.x86_64                    4/6 

  Verifying  : mysql-community-client-8.0.13-1.el7.x86_64                     5/6 

  Verifying  : 1:mariadb-libs-5.5.60-1.el7_5.x86_64                           6/6 


Installed:

  mysql-community-libs.x86_64 0:8.0.13-1.el7    mysql-community-libs-compat.x86_64 0:8.0.13-1.el7      mysql-community-server.x86_64 0:8.0.13-1.el7                  


Dependency Installed:

  mysql-community-client.x86_64 0:8.0.13-1.el7   mysql-community-common.x86_64 0:8.0.13-1.el7                    

Replaced:

  mariadb-libs.x86_64 1:5.5.60-1.el7_5                                                                                        

Complete!


이제 설치 되었다.


○ mysql 데몬 실행

]# systemctl start mysqld


○ 리부팅 했을 때 mysql 데몬 자동 실행

]# systemctl enable mysqld


○ mysql 임시 비밀번호 알아내기

]# cat /var/log/mysqld.log | grep -i 'temporary password'

2018-11-22T11:43:05.368765Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: /;ecbF)b9feS

mysql8은 초기에 임시 번호가 부여된다.


○ mysql 기본 설정. 비밀번호 변경 포함

]# mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root: 임시비번 /;ecbF)b9feS


New password: 새 비밀번호 (비밀번호는 대문자+소문자+특수문자+숫자가 포함 되어야 한다)

Re-enter new password: 비밀번호 확인

Estimated strength of the password: 100 

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y 변경 된 비밀번호를 계속 사용하시겠습니까?


Remove anonymous users? (Press y|Y for Yes, any other key for No) : y 익명사용자를 삭제 할까요?

Success.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y 원격 root 로그인 차단?

Success.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y 테스트 데이터베이스 삭제?

 - Dropping test database...

Success.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y 관리자 권한 테이블 다시 로드할까요?

Success.



이제 MySQL 설치와 설정이 끝났다.


아파치 설치하기 https://ziumb.tistory.com/105

PHP7.1 설치하기 https://ziumb.tistory.com/106


Trackback 0 Comment 0