• 워드프레스 → 라이믹스 블로그 이전 완료 일주일 동안 열지 않기
  • 목록
  • 아래로
  • 위로
  • 검색

Maria CentOS7 MariaDB 설치

키큰난쟁이 키큰난쟁이
16 0 0

MariaDB.png.jpg


 

들어가며

 

 

💡MariaDB는 오픈소스의 관계형 데이터베이스 관리 시스템(RDBMS) 이다. MySQL과 소스코드를 같이 사용하므로 사용 방법과 구조가 MySQL과 동일하다. MariaDB 커뮤니티는 MySQL과 비교해 애플리케이션 부분 속도가 약 4~5천배 정도 빠르며, MySQL이 갖는 모든 제품의 기능을 완벽히 구현하면서도 성능 면에서는 최고 70%의 향상을 보이고 있다고 주장한다.

 


 

MariaDB 저장소 추가

 

MariaDB yum 저장소 확인

  • 아래 사이트를 이용해 MariaDB OS별 설치 버전을 선택하면 Repository 정보와 설치방법을 설명을 보고 설치한다.

CentOS7 MariaDB 설치_1.png.jpg

 

↑ 필자는 CentOS7 (x86_64) 환경에 MariaDB 버전 10.6을 설치 하려고 한다.

 

MariaDB yum 저장소 추가

 

vi /etc/yum.repos.d/MariaDB.repo

↓ vi 텍스트 편집기를 이용해 다음과 같이 입력하고 저장

# MariaDB 10.6 CentOS repository list - created 2023-02-01 04:18 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
baseurl = https://tw1.mirror.blendbyte.net/mariadb/yum/10.6/centos7-amd64
gpgkey=https://tw1.mirror.blendbyte.net/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1

 


 

MariaDB 설치

 

yum을 통해 MariaDB설치

yum install MariaDB

 

설치가 완료되고 제대로 설치가 완료됬는지 확인

rpm -qa | grep MariaDB
MariaDB-compat-10.6.11-1.el7.centos.x86_64
MariaDB-client-10.6.11-1.el7.centos.x86_64
MariaDB-common-10.6.11-1.el7.centos.x86_64
MariaDB-server-10.6.11-1.el7.centos.x86_64

 

또는 MariaDB 버전을 통해 확인 가능

mariadb --version

 


 

MariaDB 시작 및 패스워드 변경

 

MariaDB 실행

systemctl start mariadb

 

MariaDB ROOT 패스워드 변경

/usr/bin/mysqladmin -u root (변경할 비밀번호)

 

MariaDB가 제대로 서비스가 되고있는지 포트 확인

netstat -anp | grep 3306
tcp6       0      0 :::3306                 :::*                    LISTEN      32131/mariadbd

 


 

MariaDB-Server 및 MariaDB-Client 설정

 

MariaDB-Server 설정

 

## 설정파일 위치 /etc/my.cnf.d/server.cnf

vi /etc/my.cnf.d/server.cnf

↓ server.cnf 파일 안에 [mysqld] 항목 아래에 아래와 같이 설정 추가

#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the mysqld standalone daemon
[mysqld]
character-set-server=utf8mb4   ## 서버 인코딩을 utf8로 설정
collation-server=utf8mb4_bin   ## 서버 인코딩을 utf8로 설정
autocommit=0                   ## 커밋된 데이터만 읽기로 설정
lower_case_table_names=1       ## 대소문자 구문 안하기로 설정
sql_mode="ANSI_QUOTES"         ## ("", 더블 쿼테이션) 사용 허용

### utf8 과 utf8mb4 차이
### utf8은 최초 mysql 설계시 utf8 규격에 4byte에 할당 된 문자가 없어 3byte로 설계 되었으나,4byte에 할당 된 문자 (이모티콘 문자)가 나오면서 4byte 확장을 위해 utf8mb4를 추가함utf8mb4로 접근 할 것을 권장.

#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0

# this is only for embedded server
[embedded]

# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]

# This group is only read by MariaDB-10.6 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.6]

 

MariaDB-Client 설정

## 설정파일 위치 : /etc/my.cnf.d/mysql-clients.cnf
vi /etc/my.cnf.d/mysql-clients.cnf
#
# These groups are read by MariaDB command-line tools
# Use it for options that affect only one utility
#
[mysql]
default-character-set=utf8mb4

[mysql_upgrade]

[mysqladmin]

[mysqlbinlog]

[mysqlcheck]

[mysqldump]
default-character-set=utf8mb4

[mysqlimport]

[mysqlshow]

[mysqlslap]

 

MariaDB 시작 또는 실행되어있을경우 재시작

systemctl start mariadb
##또는
systemctl restart mariadb

 


 

접속 확인

 

MariaDB 접속 확인

mysql
## 또는
mysql -u root -p

 


 

부팅 시 자동시작 설정

 

자동 시작

systemctl enable mariadb
## 또는
systemctl is-enabled mariadb

 

자동 끔

systemctl disable mariadb

 


 

신고공유스크랩

댓글 0

댓글 쓰기
에디터 모드

신고

"님의 댓글"

이 댓글을 신고하시겠습니까?

댓글 삭제

"님의 댓글"

이 댓글을 삭제하시겠습니까?

공유

퍼머링크