- OS : centos 7.9.2009
- DB : maria 10.9.3
[사전 설치사항]
VMware : https://www.vmware.com/products/workstation-player/workstation-player-evaluation.html
CentOS 이미지 파일 : https://www.centos.org/download/
> download now 클릭하여 vmware 설치
> 설치 시 기본 설정값 그대로 next
>> x86_64 click
>> kakao 미러 사이트 click
>> CentOS-7-x86_64-DVD-2009.iso 파일 다운로드
[vmware 에 centos 설치]
kyumin/test1234
[mariadb 설치 및 서비스등록]
1. 접속 후 su - 로 root 계정으로 변경
[kyumin@localhost ~]$ su -
Password:
Last failed login: Wed Jan 31 03:11:08 PST 2024 on pts/0
There was 1 failed login attempt since the last successful login.
[root@localhost ~]#
2. OS 버전 확인
[root@localhost ~]# cat /etc/*release*
CentOS Linux release 7.9.2009 (Core)
Derived from Red Hat Enterprise Linux 7.8 (Source)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
CentOS Linux release 7.9.2009 (Core)
CentOS Linux release 7.9.2009 (Core)
cpe:/o:centos:centos:7
3. MariaDB repo 등록
[root@localhost ~]# vi /etc/yum.repos.d/MariaDB.repo
[root@localhost ~]# cat /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = https://archive.mariadb.org/mariadb-10.9.3/yum/centos7-amd64
gpgkey = http://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck = 1
[root@localhost ~]#
4. MariaDB 설치
[root@localhost ~]# yum install MaraiDB MariaDB-server MariaDB-client
.
.
Error: Package: MariaDB-server-10.9.3-1.el7.centos.x86_64 (mariadb)
Requires: pv
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
>> 설치시 fail 이 떨어짐
5. epel 설치가 필요
[root@localhost ~]# yum install epel-release
6. 4번 다시 실행 후 설치완료됨을 확인
7. 설치된 mariadb 버전 확인
[root@localhost ~]# rpm -qa | grep Maria
MariaDB-server-10.9.3-1.el7.centos.x86_64
MariaDB-compat-10.9.3-1.el7.centos.x86_64
MariaDB-client-10.9.3-1.el7.centos.x86_64
MariaDB-common-10.9.3-1.el7.centos.x86_64
8. mariadb 기동 후 기본 설치된 database 확인
[root@localhost ~]# systemctl start mariadb
[root@localhost ~]#
[root@localhost ~]# ps -ef | grep maria
mysql 3592 1 1 03:23 ? 00:00:00 /usr/sbin/mariadbd
root 3611 3073 0 03:23 pts/0 00:00:00 grep --color=auto maria
[root@localhost ~]#
[root@localhost ~]# mariadb -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.9.3-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
MariaDB [(none)]>
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| test |
+--------------------+
5 rows in set (0.001 sec)
9. 서버 기동시 자동 DB 기동 등록
[root@localhost ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# systemctl is-enabled mariadb
enabled
10. test DB 설치 (git 설치)
[root@localhost ~]# yum install git
11. git에서 test db 다운로드
[root@localhost ~]# git clone https://github.com/datacharmer/test_db.git
Cloning into 'test_db'...
remote: Enumerating objects: 121, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 121 (delta 0), reused 0 (delta 0), pack-reused 120
Receiving objects: 100% (121/121), 74.27 MiB | 21.41 MiB/s, done.
Resolving deltas: 100% (62/62), done.
[root@localhost ~]# ls
anaconda-ks.cfg original-ks.cfg test_db
12. 설치된 test_db 경로에서 데이터 마이그레이션 진행
[root@localhost test_db]# mysql -uroot < employees.sql
13. mariadb port 인 3306 방화벽 오픈 설정
[root@localhost ~]# firewall-cmd --list-port << 현재 오픈된 port 확인
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-port=3306/tcp << 영구등록
success
[root@localhost ~]# firewall-cmd --reload << 새로고침
success
14. 로컬(window)에서 접속 할 수 있도록 현재 계정 확인 및 권한 부여
MariaDB [(none)]> select user, host from mysql.user ;
+-------------+-----------------------+
| User | Host |
+-------------+-----------------------+
| | localhost |
| mariadb.sys | localhost |
| mysql | localhost |
| root | localhost |
| | localhost.localdomain |
+-------------+-----------------------+
5 rows in set (0.007 sec)
MariaDB [(none)]> grant all privileges on *.* to 'root'@'%' identified by 'passwd';
Query OK, 0 rows affected (0.014 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.001 sec)
15. DB 접속 확인
'Mysql & Maria > admin' 카테고리의 다른 글
mysqlslap 사용 부하테스트 (0) | 2024.04.18 |
---|---|
[환경변수] binlog_format (0) | 2024.02.23 |
Mysql xtrabackup 백업 및 복구 (slave 서버 재구성) (0) | 2024.01.11 |
트랜잭션 격리수준 (1) | 2023.11.29 |
root 비밀 번호 분실시 (0) | 2023.11.28 |