MySQL

[MariaDB] CentOS 7 에 MariaDB 10.6 설치 가이드

dbdb딥 2022. 11. 24. 10:30
반응형
[MariaDB] CentOS 7 에 MariaDB 10.6 설치 가이드

 

 

OS 환경

CentOS 7

 

DB 환경

MariaDB 10.6.x

 

MariaDB 설치

https://downloads.mariadb.org/mariadb/repositories/#mirror=yongbok

 

Download MariaDB Server - MariaDB.org

REST API Release Schedule Reporting Bugs … Continue reading "Download MariaDB Server"

mariadb.org

접속 후 해당 버전에 맞춰 셋팅

 

 

Yum 저장소 파일생성

[root@host01 ~]# vi /etc/yum.repos.d/MariaDB.repo

# MariaDB 10.6 CentOS repository list - created 2022-11-24 00:36 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

 

설치

[root@host01 ~]# yum install -y MariaDB-server MariaDB-client

 

my.cnf 수정

[root@host01 ~]# vi /etc/my.cnf.d/server.cnf

[client]
port                            = 3306
socket                          = /var/lib/mysql/mysql.sock
 
[mysqld]
port                            = 3306
socket                          = /var/lib/mysql/mysql.sock
character-set-server            = utf8mb4
collation_server                = utf8mb4_general_ci
basedir                         = /var/lib/mysql
datadir                         = /var/lib/mysql
log_error                       = /var/lib/mysql/mysqld.log
slow_query_log                  = 1
slow_query_log_file             = /var/lib/mysql/mysql_slow_query.log
log-bin                         = /var/lib/mysql/mysql-bin
pid-file                        = /var/lib/mysql/host01.pid
innodb_buffer_pool_size         = 1G
default-storage-engine          = innodb

 

MariaDB 구동

[root@host01 ~]# systemctl start mysqld
[root@host01 ~]# systemctl enable mysqld
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

 

MariaDB 기본 설정

[root@host01 ~]# mariadb-secure-installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):      # 패스워드가 없기 때문에 엔터
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] y	# 통신 소켓 여부: y
Enabled successfully!
Reloading privilege tables..
 ... Success!


You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] y	# root password 설정 : y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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? [Y/n] 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? [Y/n] y	# root 원격 접근 거부 여부(localhost만 사용 가능하게) :y
 ... Success!

By default, MariaDB 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? [Y/n] y		# test 용 DB 제거 여부 : 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? [Y/n] y		# 설정 값 적용 : y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
[root@host01 ~]#

 

DB 접속
[root@host01 ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 10.6.11-MariaDB-log 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)]>
반응형
맨 위로