본문 바로가기

DB/Mysql

[mysql] centos mysql 8.0 설치

728x90
반응형

1.저장소설치

yum install https://dev.mysql.com/get/mysql80-community-release-el7-6.noarch.rpm

Loaded plugins: fastestmirror
mysql80-community-release-el7-6.noarch.rpm                                                                                             |  11 kB  00:00:00     
Examining /var/tmp/yum-root-wnHzco/mysql80-community-release-el7-6.noarch.rpm: mysql80-community-release-el7-6.noarch
Marking /var/tmp/yum-root-wnHzco/mysql80-community-release-el7-6.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql80-community-release.noarch 0:el7-6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================
 Package                                     Arch                     Version                 Repository                                                 Size
==============================================================================================================================================================
Installing:
 mysql80-community-release                   noarch                   el7-6                   /mysql80-community-release-el7-6.noarch                    10 k

Transaction Summary
==============================================================================================================================================================
Install  1 Package

Total size: 10 k
Installed size: 10 k
Is this ok [y/d/N]:  y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : mysql80-community-release-el7-6.noarch                                                                                                     1/1 
  Verifying  : mysql80-community-release-el7-6.noarch                                                                                                     1/1 

Installed:
  mysql80-community-release.noarch 0:el7-6                                                                                                                    

Complete!

2. 설치 

yum install mysql-server

 mysql-community-icu-data-files                     x86_64                     8.0.33-1.el7                       mysql80-community                     2.1 M
 mysql-community-libs                               x86_64                     8.0.33-1.el7                       mysql80-community                     1.5 M

Transaction Summary
==============================================================================================================================================================
Install  1 Package (+5 Dependent packages)

Total download size: 88 M
Installed size: 417 M
Is this ok [y/d/N]:  y
Downloading packages:
(1/6): mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm                                                                          | 3.6 MB  00:00:04     
(2/6): mysql-community-common-8.0.33-1.el7.x86_64.rpm                                                                                  | 664 kB  00:00:02     
(3/6): mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm                                                                          | 2.1 MB  00:00:06     
(4/6): mysql-community-client-8.0.33-1.el7.x86_64.rpm                                                                                  |  16 MB  00:00:14     
(5/6): mysql-community-libs-8.0.33-1.el7.x86_64.rpm                                                                                    | 1.5 MB  00:00:10     
(6/6): mysql-community-server-8.0.33-1.el7.x86_64.rpm                                                                                  |  64 MB  00:00:20     
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                         2.5 MB/s |  88 MB  00:00:35     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mysql-community-client-plugins-8.0.33-1.el7.x86_64                                                                                         1/6 
  Installing : mysql-community-common-8.0.33-1.el7.x86_64                                                                                                 2/6 
  Installing : mysql-community-libs-8.0.33-1.el7.x86_64                                                                                                   3/6 
  Installing : mysql-community-client-8.0.33-1.el7.x86_64                                                                                                 4/6 
  Installing : mysql-community-icu-data-files-8.0.33-1.el7.x86_64                                                                                         5/6 
  Installing : mysql-community-server-8.0.33-1.el7.x86_64                                                                                                 6/6 
  Verifying  : mysql-community-common-8.0.33-1.el7.x86_64                                                                                                 1/6 
  Verifying  : mysql-community-server-8.0.33-1.el7.x86_64                                                                                                 2/6 
  Verifying  : mysql-community-client-plugins-8.0.33-1.el7.x86_64                                                                                         3/6 
  Verifying  : mysql-community-libs-8.0.33-1.el7.x86_64                                                                                                   4/6 
  Verifying  : mysql-community-icu-data-files-8.0.33-1.el7.x86_64                                                                                         5/6 
  Verifying  : mysql-community-client-8.0.33-1.el7.x86_64                                                                                                 6/6 

Installed:
  mysql-community-server.x86_64 0:8.0.33-1.el7                                                                                                                

Dependency Installed:
  mysql-community-client.x86_64 0:8.0.33-1.el7           mysql-community-client-plugins.x86_64 0:8.0.33-1.el7   mysql-community-common.x86_64 0:8.0.33-1.el7  
  mysql-community-icu-data-files.x86_64 0:8.0.33-1.el7   mysql-community-libs.x86_64 0:8.0.33-1.el7            

Complete!

3. 저장소 정보변경

vi /etc/yum.repos.d/mysql-community.repo

4. 초기 비밀번호 확인 

grep 'temporary password' /var/log/mysqld.log
2023-01-0113:45:14.124228Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 여기비밀번호
2023-04-2113:42:38.671540Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 여기비밀번호

 

5. root 계정 로그인 후 초기 비밀번호 변경

[root@OOOOO lib]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.33

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

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> ALTER USER 'root'@'localhost' IDENTIFIED BY '여기초기비밀번호설정';

6. 강화된 비밀번호 정책 푸는 방법 (ERROR 1819 (HY000): Your password does not satisfy the current policy requirements)

echo 'validate_password.length=6' | sudo tee -a /etc/my.cnf
echo 'validate_password.special_char_count=0' | sudo tee -a /etc/my.cnf
echo 'validate_password.mixed_case_count=0' | sudo tee -a /etc/my.cnf
echo 'validate_password.number_count=0' | sudo tee -a /etc/my.cnf
728x90
반응형