OS 환경 : Oracle Linux 7.6 (64bit)
DB 환경 : Oracle Mysql 8.0
방법 : Oracle Linux 7.6에 Mysql 8.0 설치 가이드
본문에서는 oracle linux 7에 mysql 8을 설치하는 방법을 설명함
MySQL 공식 레포지토리 등록
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# yum install -y https://dev.mysql.com/get/mysql80-community-release-el7-11.noarch.rpm
Loaded plugins: langpacks, ulninfo
mysql80-community-release-el7-11.noarch.rpm | 14 kB 00:00:00
Examining /var/tmp/yum-root-Zex24z/mysql80-community-release-el7-11.noarch.rpm: mysql80-community-release-el7-11.noarch
Marking /var/tmp/yum-root-Zex24z/mysql80-community-release-el7-11.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql80-community-release.noarch 0:el7-11 will be installed
--> Finished Dependency Resolution
ol7_UEKR5/x86_64 | 3.0 kB 00:00:00
ol7_UEKR5/x86_64/updateinfo | 520 kB 00:00:00
ol7_UEKR5/x86_64/primary_db | 87 MB 00:00:01
ol7_latest/x86_64 | 3.6 kB 00:00:00
ol7_latest/x86_64/group_gz | 136 kB 00:00:00
ol7_latest/x86_64/updateinfo | 3.7 MB 00:00:00
ol7_latest/x86_64/primary_db | 54 MB 00:00:00
Dependencies Resolved
=====================================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================================
Installing:
mysql80-community-release noarch el7-11 /mysql80-community-release-el7-11.noarch 17 k
Transaction Summary
=====================================================================================================================================================================
Install 1 Package
Total size: 17 k
Installed size: 17 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mysql80-community-release-el7-11.noarch 1/1
Verifying : mysql80-community-release-el7-11.noarch 1/1
Installed:
mysql80-community-release.noarch 0:el7-11
Complete!
|
MySQL 8 저장소 활성화
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# yum-config-manager --enable mysql80-community
Loaded plugins: langpacks
====================================================================== repo: mysql80-community ======================================================================
[mysql80-community]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7Server
baseurl = http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64
cache = 0
cachedir = /var/cache/yum/x86_64/7Server/mysql80-community
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage =
enabled = True
enablegroups = True
exclude =
failovermethod = priority
ftp_disable_epsv = False
gpgcadir = /var/lib/yum/repos/x86_64/7Server/mysql80-community/gpgcadir
gpgcakey =
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7Server/mysql80-community/gpgdir
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023,
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022,
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
hdrdir = /var/cache/yum/x86_64/7Server/mysql80-community/headers
http_caching = all
includepkgs =
ip_resolve =
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid =
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink =
minrate = 0
mirrorlist =
mirrorlist_expire = 86400
name = MySQL 8.0 Community Server
old_base_cache_dir =
password =
persistdir = /var/lib/yum/repos/x86_64/7Server/mysql80-community
pkgdir = /var/cache/yum/x86_64/7Server/mysql80-community/packages
proxy = False
proxy_dict =
proxy_password =
proxy_username =
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert =
sslclientcert =
sslclientkey =
sslverify = True
throttle = 0
timeout = 30.0
ui_id = mysql80-community/x86_64
ui_repoid_vars = releasever,
basearch
username =
|
참고. mysql57-community 등 다른 버전 저장소가 켜져 있으면 충돌 할수 있음, 이 경우 disable 처리
1
|
# yum-config-manager --disable mysql57-community
|
MySQL 8 설치
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
# yum install -y mysql-community-server
Loaded plugins: langpacks, ulninfo
mysql-connectors-community | 2.6 kB 00:00:00
mysql-tools-community | 2.6 kB 00:00:00
mysql80-community | 2.6 kB 00:00:00
(1/3): mysql-tools-community/x86_64/primary_db | 105 kB 00:00:00
(2/3): mysql-connectors-community/x86_64/primary_db | 126 kB 00:00:00
(3/3): mysql80-community/x86_64/primary_db | 331 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:8.0.42-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 8.0.42-1.el7 for package: mysql-community-server-8.0.42-1.el7.x86_64
--> Processing Dependency: mysql-community-icu-data-files = 8.0.42-1.el7 for package: mysql-community-server-8.0.42-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 8.0.11 for package: mysql-community-server-8.0.42-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:8.0.42-1.el7 will be installed
--> Processing Dependency: mysql-community-client-plugins = 8.0.42-1.el7 for package: mysql-community-client-8.0.42-1.el7.x86_64
--> Processing Dependency: mysql-community-libs(x86-64) >= 8.0.11 for package: mysql-community-client-8.0.42-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:8.0.42-1.el7 will be installed
---> Package mysql-community-icu-data-files.x86_64 0:8.0.42-1.el7 will be installed
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.64-1.el7 will be obsoleted
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-7.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-7.el7.x86_64
---> Package mysql-community-client-plugins.x86_64 0:8.0.42-1.el7 will be installed
---> Package mysql-community-libs.x86_64 0:8.0.42-1.el7 will be obsoleting
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:8.0.42-1.el7 will be obsoleting
---> Package postfix.x86_64 2:2.10.1-7.el7 will be updated
---> Package postfix.x86_64 2:2.10.1-9.el7 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================================
Installing:
mysql-community-libs x86_64 8.0.42-1.el7 mysql80-community 1.5 M
replacing mariadb-libs.x86_64 1:5.5.64-1.el7
mysql-community-libs-compat x86_64 8.0.42-1.el7 mysql80-community 669 k
replacing mariadb-libs.x86_64 1:5.5.64-1.el7
mysql-community-server x86_64 8.0.42-1.el7 mysql80-community 65 M
Installing for dependencies:
mysql-community-client x86_64 8.0.42-1.el7 mysql80-community 16 M
mysql-community-client-plugins x86_64 8.0.42-1.el7 mysql80-community 3.5 M
mysql-community-common x86_64 8.0.42-1.el7 mysql80-community 665 k
mysql-community-icu-data-files x86_64 8.0.42-1.el7 mysql80-community 2.2 M
Updating for dependencies:
postfix x86_64 2:2.10.1-9.el7 ol7_latest 2.4 M
Transaction Summary
=====================================================================================================================================================================
Install 3 Packages (+4 Dependent packages)
Upgrade ( 1 Dependent package)
Total download size: 92 M
Downloading packages:
No Presto metadata available for ol7_latest
warning: /var/cache/yum/x86_64/7Server/mysql80-community/packages/mysql-community-client-plugins-8.0.42-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID a8d3785c: NOKEY
Public key for mysql-community-client-plugins-8.0.42-1.el7.x86_64.rpm is not installed
(1/8): mysql-community-client-plugins-8.0.42-1.el7.x86_64.rpm | 3.5 MB 00:00:00
(2/8): mysql-community-common-8.0.42-1.el7.x86_64.rpm | 665 kB 00:00:00
(3/8): mysql-community-icu-data-files-8.0.42-1.el7.x86_64.rpm | 2.2 MB 00:00:00
(4/8): mysql-community-libs-8.0.42-1.el7.x86_64.rpm | 1.5 MB 00:00:00
(5/8): mysql-community-libs-compat-8.0.42-1.el7.x86_64.rpm | 669 kB 00:00:00
(6/8): mysql-community-client-8.0.42-1.el7.x86_64.rpm | 16 MB 00:00:01
warning: /var/cache/yum/x86_64/7Server/ol7_latest/packages/postfix-2.10.1-9.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY8 MB 00:00:03 ETA
Public key for postfix-2.10.1-9.el7.x86_64.rpm is not installed
(7/8): postfix-2.10.1-9.el7.x86_64.rpm | 2.4 MB 00:00:00
(8/8): mysql-community-server-8.0.42-1.el7.x86_64.rpm | 65 MB 00:00:01
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 30 MB/s | 92 MB 00:00:03
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
Importing GPG key 0xA8D3785C:
Userid : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
Fingerprint: bca4 3417 c3b4 85dd 128e c6d4 b7b3 b788 a8d3 785c
Package : mysql80-community-release-el7-11.noarch (@/mysql80-community-release-el7-11.noarch)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
Importing GPG key 0x3A79BD29:
Userid : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
Fingerprint: 859b e8d7 c586 f538 430b 19c2 467b 942d 3a79 bd29
Package : mysql80-community-release-el7-11.noarch (@/mysql80-community-release-el7-11.noarch)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
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-11.noarch (@/mysql80-community-release-el7-11.noarch)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Importing GPG key 0xEC551F03:
Userid : "Oracle OSS group (Open Source Software group) <build@oss.oracle.com>"
Fingerprint: 4214 4123 fecf c55b 9086 313d 72f9 7b74 ec55 1f03
Package : 7:oraclelinux-release-7.7-1.0.5.el7.x86_64 (@anaconda/7.7)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mysql-community-common-8.0.42-1.el7.x86_64 1/10
Installing : mysql-community-client-plugins-8.0.42-1.el7.x86_64 2/10
Installing : mysql-community-libs-8.0.42-1.el7.x86_64 3/10
Installing : mysql-community-libs-compat-8.0.42-1.el7.x86_64 4/10
Installing : mysql-community-client-8.0.42-1.el7.x86_64 5/10
Installing : mysql-community-icu-data-files-8.0.42-1.el7.x86_64 6/10
Installing : mysql-community-server-8.0.42-1.el7.x86_64 7/10
Updating : 2:postfix-2.10.1-9.el7.x86_64 8/10
Cleanup : 2:postfix-2.10.1-7.el7.x86_64 9/10
Erasing : 1:mariadb-libs-5.5.64-1.el7.x86_64 10/10
Verifying : mysql-community-libs-8.0.42-1.el7.x86_64 1/10
Verifying : 2:postfix-2.10.1-9.el7.x86_64 2/10
Verifying : mysql-community-icu-data-files-8.0.42-1.el7.x86_64 3/10
Verifying : mysql-community-libs-compat-8.0.42-1.el7.x86_64 4/10
Verifying : mysql-community-client-8.0.42-1.el7.x86_64 5/10
Verifying : mysql-community-server-8.0.42-1.el7.x86_64 6/10
Verifying : mysql-community-client-plugins-8.0.42-1.el7.x86_64 7/10
Verifying : mysql-community-common-8.0.42-1.el7.x86_64 8/10
Verifying : 1:mariadb-libs-5.5.64-1.el7.x86_64 9/10
Verifying : 2:postfix-2.10.1-7.el7.x86_64 10/10
Installed:
mysql-community-libs.x86_64 0:8.0.42-1.el7 mysql-community-libs-compat.x86_64 0:8.0.42-1.el7 mysql-community-server.x86_64 0:8.0.42-1.el7
Dependency Installed:
mysql-community-client.x86_64 0:8.0.42-1.el7 mysql-community-client-plugins.x86_64 0:8.0.42-1.el7 mysql-community-common.x86_64 0:8.0.42-1.el7
mysql-community-icu-data-files.x86_64 0:8.0.42-1.el7
Dependency Updated:
postfix.x86_64 2:2.10.1-9.el7
Replaced:
mariadb-libs.x86_64 1:5.5.64-1.el7
Complete!
|
MySQL 서비스 시작 및 자동 시작 등록, 확인
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# systemctl start mysqld
# systemctl enable mysqld
# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2025-06-08 14:45:00 KST; 10s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Main PID: 5204 (mysqld)
Status: "Server is operational"
CGroup: /system.slice/mysqld.service
└─5204 /usr/sbin/mysqld
Jun 08 14:44:53 my8 systemd[1]: Starting MySQL Server...
Jun 08 14:45:00 my8 systemd[1]: Started MySQL Server.
|
임시 root 비밀번호 확인
1
2
|
# grep 'temporary password' /var/log/mysqld.log
2025-06-08T05:53:03.230626Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: .PxAajW6P,eo
|
현재 임시 패스워드는 ".PxAajW6P,eo"임
보안 설정 스크립트 실행
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root: <<-- 현재 패스워드 입력 ".PxAajW6P,eo"
The existing password for the user account root has expired. Please set a new password.
New password: <<-- 변경할 패스워드 입력 "Akdlsql1!"
Re-enter new password: <<-- 변경할 패스워드 재입력 "Akdlsql1!"
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
Using existing password for root.
Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n <<-- 패스워드 변경할건지 물어보는 질문 N 입력
... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y <<-- 익명유저 삭제할건지 물어보는 질문 Y 입력
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y <<-- 원격접속 비활성화 할건지 물어보는 질문 Y 입력
Success.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y <<-- test database 제거할건지 물어보는 질문 Y 입력
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y 위 내용들 적용할건지 물어보는 질문 Y 입력
Success.
All done!
|
MySQL 접속
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# mysql -u root -p
Enter password: <<-- root 패스워드 입력("Akdlsql1!")
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.42 MySQL Community Server - GPL
Copyright (c) 2000, 2025, 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> select version();
+-----------+
| version() |
+-----------+
| 8.0.42 |
+-----------+
1 row in set (0.00 sec)
|
정상적으로 설치됨
os에서도 버전 확인
1
2
|
# mysql --version
mysql Ver 8.0.42 for Linux on x86_64 (MySQL Community Server - GPL)
|
8.0.42임
참고. 방화벽에서 포트 3306 열기(mysql 기본포트)
1
2
|
# firewall-cmd --permanent --add-port=3306/tcp
# firewall-cmd --reload
|
참조 :