Database

[Database] MariaDB Install

Richard.Ryu 2024. 3. 13. 12:06
반응형

MariaDB는 Mysql 을 대체하기 위해서 개발되었으며,

 

Mysql 의 호환성을 유지하고 모든 기능을 제공하기위해 개발되었습니다.

 

Redhat 계열(CentOS)을 사용하시면 yum -y install mysql 을 하셔도 mariaDB가 설치되실 겁니다.

 

1. MariaDB PKG install

[root@localhost dev]# yum -y install mysql
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.navercorp.com
 * extras: mirror.navercorp.com
 * updates: mirror.navercorp.com
Resolving Dependencies
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.68-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================================================
 Package                                        Arch                                          Version                                                 Repository                                   Size
========================================================================================================================================================================================================
Installing:
 mariadb                                        x86_64                                        1:5.5.68-1.el7                                          base                                        8.8 M

Transaction Summary
========================================================================================================================================================================================================
Install  1 Package

Total download size: 8.8 M
Installed size: 49 M
Downloading packages:
mariadb-5.5.68-1.el7.x86_64.rpm                                                                                                                                                  | 8.8 MB  00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:mariadb-5.5.68-1.el7.x86_64                                                                                                                                                        1/1
  Verifying  : 1:mariadb-5.5.68-1.el7.x86_64                                                                                                                                                        1/1

Installed:
  mariadb.x86_64 1:5.5.68-1.el7

Complete!

 

위에 따라서 직접적으로 설치를 진행할 때는 아래와 같이 입력합니다.

[root@localhost home]# yum -y install mariadb mariadb-server

 

2. Mariadb 시작 및 자동시작 설정

설치가 완료되면, 아래와 같이 입력하여 실행 및 자동 재시작을 등록합니다.

[root@localhost home]# systemctl start mariadb
[root@localhost home]# systemctl enable mariadb
[root@localhost home]# systemctl status mariadb
● mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2024-03-12 22:43:05 EDT; 6s ago
  Process: 27718 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
  Process: 27626 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
 Main PID: 27717 (mysqld_safe)
    Tasks: 20
   Memory: 102.6M
   CGroup: /system.slice/mariadb.service
           ├─27717 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
           └─27882 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid ...

Mar 12 22:43:03 localhost.localdomain mariadb-prepare-db-dir[27626]: Alternatively you can run:
Mar 12 22:43:03 localhost.localdomain mariadb-prepare-db-dir[27626]: '/usr/bin/mysql_secure_installation'
Mar 12 22:43:03 localhost.localdomain mariadb-prepare-db-dir[27626]: which will also give you the option of removing the test
Mar 12 22:43:03 localhost.localdomain mariadb-prepare-db-dir[27626]: databases and anonymous user created by default.  This is
Mar 12 22:43:03 localhost.localdomain mariadb-prepare-db-dir[27626]: strongly recommended for production servers.
Mar 12 22:43:03 localhost.localdomain mariadb-prepare-db-dir[27626]: See the MariaDB Knowledgebase at http://mariadb.com/kb or the
Mar 12 22:43:03 localhost.localdomain mariadb-prepare-db-dir[27626]: MySQL manual for more instructions.
Mar 12 22:43:03 localhost.localdomain mysqld_safe[27717]: 240312 22:43:03 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Mar 12 22:43:03 localhost.localdomain mysqld_safe[27717]: 240312 22:43:03 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Mar 12 22:43:05 localhost.localdomain systemd[1]: Started MariaDB database server.

 

3. MariaDB 접속

본문 처음에 말씀드렸듯이 mysql 기반이기에 아래 mysql -u root -p 입력하고,

초기 Password 를 설정하지 않았기에 Enter 누르시면 접속됩니다.

[root@localhost system]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.68-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)]> show databases;
    -> ;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.01 sec)

MariaDB [(none)]>

 

 

반응형