MariaDB 설치
기본적으로 Linux yum repository에는 MariaDB가 등록되어 있지 않다고 합니다.
버전마다 달라서 그런거 같기는 합니다.
이곳에 가면 자신의 OS에 맞게 세팅하는 방법이 나와 있습니다.
https://downloads.mariadb.org/mariadb/repositories/
저는 CentOS. x86_64. 10.4로 선택하였습니다.
MariaDB Downloads Select
/ect/yum.repos.d/mariadb.repo 에 해당 내용을 적어주세요.
# vi /etc/yum.repos.d/mariadb.repo
파일 안의 내용
# MariaDB 10.4 CentOS repository list - created 2020-01-19 02:20 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos8-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
그리고 다음을 실행합니다.
sudo dnf install boost-program-options
sudo dnf install MariaDB-server MariaDB-client --disablerepo=AppStream
sudo systemctl start mariadb
어엄청나게 오래 걸릴겁니다. 다운로드 속도가 빠르지도 않고. 아무튼 그렇습니다.
Manage MariaDB Service
# systemctl start mariadb
# systemctl stop mariadb
# systemctl status mariadb
위에서 부터 시작 / 종료 / 상태 확인 입니다.
[deploy@database ~]$ systemctl status mariadb
● mariadb.service - MariaDB 10.4.11 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: active (running) since Sun 2020-01-19 01:11:04 KST; 2h 14min ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 12052 (mysqld)
Status: "Taking your SQL requests now..."
Tasks: 30 (limit: 11513)
Memory: 76.0M
CGroup: /system.slice/mariadb.service
└─12052 /usr/sbin/mysqld
Active: active (running) 이면 정상입니다.
Secure MariaDB Installation
보안 관련된 부분을 설정하는 명령을 사용합니다.
$ mysql_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): << Just Press Enter
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] N << Disable Unix Socket Authendication to Enable Password Authentication
... skipping.
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] Y << Set MariaDB root password
New password: << Enter root password
Re-enter new password: << Re-Enter root 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 << Remove Anonymous user
... 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 << Disallow root login remotely
... 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 << Remove test database
- 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 << Reload privilege tables
... 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!
Access MariaDB
위에 설정한 내용을 가지고 로그인을 하여서 테스트 해봅시다.
# mysql -u root -p
이렇게 하면 패스워드를 넣으라 할겁니다.
[root@database deploy]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 52
Server version: 10.4.11-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)]>
하고 나면 이런식으로 나오게 될겁니다.