반응형
- DB Version : mariadb-10.5.9-linux
- OS Version : Centos 7.9
Mariadb 설치 파일 다운로드
https://downloads.mariadb.org/
- Mariadb 지원되는 OS으로는 Linux, Winodws계열
- Windows 같은 경우 설치 파일이 MSI 방식과 ZIP방식 존재
- Linux 같은 경우 Source, Binary, Package(RPM) 존재
- 설치 정보
MariaDB 버전 | 10.5.9 |
설치경로: Engine(basedir) | /usr/local/mariadb |
Data(datadir) | /data/mariadb/DATA |
Error log | /data/mariadb/ADMIN/error.log |
Binary LOG | /data/mariadb/BINLOG |
RELAY LOG | /data/mariadb/RELAYLOG |
InnoDB LOG | /data/mariadb/IBLOG |
socket | /data/mariadb/TMP/mysql.sock |
config | /etc/my.cnf |
- Mariadb 설치
# firewall 및 selinux 설정 방화벽 적용 [root@TestDB ~]#firewall-cmd --permanent --zone=public --add-port=3306/tcp [root@TestDB ~]#firewall-cmd --reload [root@TestDB ~]#iptables -I INPUT 1 -p tcp --dport 3306 -j ACCEPT selinux = disable 적용 [root@ProdDB ~]# vi /etc/selinux/config SELINUX=disabled reboot # 사용자, 그룹 생성 [root@TestDB ~]#groupadd mysql [root@TestDB ~]#useradd -g mysql mysql # DATA, LOG 디렉토리 생성 [root@TestDB TestDB ~]#mkdir -p /data/mariadb/ADMIN [root@TestDB ~]#mkdir -p /data/mariadb/DATA [root@TestDB ~]#mkdir -p /data/mariadb/BINLOG [root@TestDB ~]#mkdir -p /data/mariadb/RELAYLOG [root@TestDB ~]#mkdir -p /data/mariadb/IBLOG [root@TestDB ~]#mkdir -p /data/mariadb/BACKUP [root@TestDB ~]#mkdir -p /data/mariadb/TMP # 사용자, 그룹 mysql로 변경 [root@TestDB ~]#chown -R mysql:mysql /data [root@TestDB ~]#ls -al /data/mariadb/ 합계 36 drwxr-xr-x 9 mysql mysql 4096 6월 10 12:05 . drwxr-xr-x 4 mysql mysql 4096 6월 10 12:04 .. drwxr-xr-x 2 mysql mysql 4096 6월 10 12:04 ADMIN drwxr-xr-x 2 mysql mysql 4096 6월 10 12:04 BACKUP drwxr-xr-x 2 mysql mysql 4096 6월 10 12:04 BINLOG drwxr-xr-x 2 mysql mysql 4096 6월 10 12:04 DATA drwxr-xr-x 2 mysql mysql 4096 6월 10 12:04 IBLOG drwxr-xr-x 2 mysql mysql 4096 6월 10 12:04 RELAYLOG drwxr-xr-x 2 mysql mysql 4096 6월 10 12:05 TMP # mariadb-10.5.9 패키지 압축 해제 [root@TestDB ~]# tar xvfz mariadb-10.5.9-linux-systemd-x86_64.tar.gz mariadb-10.5.9-linux-systemd-x86_64/mysql-test/plugin/rocksdb/rocksdb/t/col_opt_default.test mariadb-10.5.9-linux-systemd-x86_64/mysql-test/plugin/rocksdb/rocksdb/t/locking_issues.test mariadb-10.5.9-linux-systemd-x86_64/mysql-test/plugin/rocksdb/rocksdb/t/kill.test mariadb-10.5.9-linux-systemd-x86_64/mysql-test/plugin/rocksdb/rocksdb/t/drop_table3-master.opt mariadb-10.5.9-linux-systemd-x86_64/mysql-test/plugin/rocksdb/rocksdb/t/tbl_opt_pack_keys.test mariadb-10.5.9-linux-systemd-x86_64/mysql-test/plugin/rocksdb/rocksdb/t/1st.test mariadb-10.5.9-linux-systemd-x86_64/mysql-test/plugin/rocksdb/rocksdb/t/issue495.test mariadb-10.5.9-linux-systemd-x86_64/mysql-test/plugin/rocksdb/rocksdb/t/optimize_myrocks_replace_into_lock.test .............. 중략 .............. mariadb-10.5.9-linux-systemd-x86_64/lib/plugin/cracklib_password_check.so mariadb-10.5.9-linux-systemd-x86_64/lib/plugin/query_response_time.so mariadb-10.5.9-linux-systemd-x86_64/lib/plugin/auth_pam.so mariadb-10.5.9-linux-systemd-x86_64/lib/pkgconfig/ mariadb-10.5.9-linux-systemd-x86_64/lib/pkgconfig/libmariadb.pc mariadb-10.5.9-linux-systemd-x86_64/lib/pkgconfig/mariadb.pc mariadb-10.5.9-linux-systemd-x86_64/lib/libmariadb.so.3 # 압축 해제 한 파일을 엔진 경로로 이동 [root@TestDB ~]# mv mariadb-10.5.9-linux-systemd-x86_64 /usr/local/mariadb [root@TestDB ~]# cd /usr/local/mariadb [root@TestDB mariadb]# ll 합계 196 -rw-r--r-- 1 mysql mysql 17987 2월 19 18:41 COPYING -rw-r--r-- 1 mysql mysql 2354 2월 19 18:41 CREDITS -rw-r--r-- 1 mysql mysql 8245 2월 19 18:41 EXCEPTIONS-CLIENT -rw-r--r-- 1 mysql mysql 8782 2월 19 18:41 INSTALL-BINARY -rw-r--r-- 1 mysql mysql 19520 2월 19 18:41 README-wsrep -rw-r--r-- 1 mysql mysql 2973 2월 19 18:41 README.md -rw-r--r-- 1 mysql mysql 86263 2월 19 18:41 THIRDPARTY drwxr-xr-x 2 mysql mysql 4096 10월 22 2020 bin drwxrwxr-x 3 mysql mysql 4096 2월 20 06:46 include drwxr-xr-x 5 mysql mysql 4096 1월 21 05:56 lib drwxrwxr-x 4 mysql mysql 4096 2월 20 06:46 man drwxrwxr-x 9 mysql mysql 4096 2월 20 06:46 mysql-test drwxrwxr-x 2 mysql mysql 4096 2월 20 06:46 scripts drwxrwxr-x 31 mysql mysql 4096 2월 20 06:46 share drwxrwxr-x 4 mysql mysql 4096 2월 20 06:46 sql-bench drwxrwxr-x 4 mysql mysql 4096 2월 20 06:46 support-files # PATH 추가 설정 [root@TestDB ~]# vi /etc/profile export MYSQL_PATH=/usr/local/mariadb/bin:/usr/local/mariadb/scripts export PATH=$PATH:$MYSQL_PATH # MariaDB config 파일 설정 (/etc/my.cnf) [root@TestDB ~]# vi /etc/my.cnf MariaDB my.cnf 샘플
# libaio 패키지 설치( 미설치 라이브러리 오류가 발생) [root@TestDB ~]# yum install libaio Loaded plugins: fastestmirror Determining fastest mirrors local-repo | 3.6 kB 00:00:00 zabbix | 2.9 kB 00:00:00 zabbix-non-supported | 2.9 kB 00:00:00 Resolving Dependencies --> Running transaction check ---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ========================================================================================================================================================================= Package Arch Version Repository Size ========================================================================================================================================================================= Installing: libaio x86_64 0.3.109-13.el7 local-repo 24 k Transaction Summary ========================================================================================================================================================================= Install 1 Package Total download size: 24 k Installed size: 38 k Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : libaio-0.3.109-13.el7.x86_64 1/1 Verifying : libaio-0.3.109-13.el7.x86_64 1/1 Installed: libaio.x86_64 0:0.3.109-13.el7 Complete! # mariadb 인스톨 [root@TestDB ~]# cd /usr/local/mariadb [root@TestDB mariadb]# ./scripts/mysql_install_db --user=mysql Installing MariaDB/MySQL system tables in '/data/mariadb/DATA' ... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system Two all-privilege accounts were created. One is root@localhost, it has no password, but you need to be system 'root' user to connect. Use, for example, sudo mysql The second is mysql@localhost, it has no password either, but you need to be the system 'mysql' user to connect. After connecting you can set the password, if you would need to be able to connect as any of these users with a password and without sudo See the MariaDB Knowledgebase at https://mariadb.com/kb or the MySQL manual for more instructions. You can start the MariaDB daemon with: cd '/usr/local/mariadb' ; /usr/local/mariadb/bin/mysqld_safe --datadir='/data/mariadb/DATA' You can test the MariaDB daemon with mysql-test-run.pl cd '/usr/local/mariadb/mysql-test' ; perl mysql-test-run.pl Please report any problems at https://mariadb.org/jira The latest information about MariaDB is available at https://mariadb.org/. You can find additional information about the MySQL part at: https://dev.mysql.com Consider joining MariaDB's strong and vibrant community: https://mariadb.org/get-involved/ # 인스톨 후, 정상적으로 DATA, LOG 파일 생성됐는지 확인 [root@TestDB mariadb]# ll /data/mariadb/ADMIN/ 합계 4 -rw-rw---- 1 mysql mysql 798 6월 10 12:47 error.log [root@TestDB mariadb]# ll /data/mariadb/BINLOG/ 합계 40 -rw-rw---- 1 mysql mysql 27318 6월 10 12:47 binary_log.000001 -rw-rw---- 1 mysql mysql 40 6월 10 12:47 binary_log.index -rw-rw---- 1 mysql mysql 9 6월 10 12:47 binary_log.state [root@TestDB mariadb]# ll /data/mariadb/DATA/ 합계 12336 -rw-rw---- 1 mysql mysql 24576 6월 10 12:47 aria_log.00000001 -rw-rw---- 1 mysql mysql 52 6월 10 12:47 aria_log_control -rw-rw---- 1 mysql mysql 972 6월 10 12:47 ib_buffer_pool -rw-rw---- 1 mysql mysql 12582912 6월 10 12:47 ibdata1 drwx------ 2 mysql mysql 4096 6월 10 12:47 mysql drwx------ 2 mysql mysql 4096 6월 10 12:47 performance_schema drwx------ 2 mysql mysql 4096 6월 10 12:47 test [root@TestDB mariadb]# ll /data/mariadb/IBLOG/ 합계 512004 -rw-rw---- 1 mysql mysql 524288000 6월 10 12:47 ib_logfile0 # mariadb 기동 [root@TestDB mariadb]# ./bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql & [2] 67490 210610 13:36:07 mysqld_safe Logging to '/data/mariadb/ADMIN/error.log'. 210610 13:36:07 mysqld_safe Starting mariadbd daemon with databases from /data/mariadb/DATA # mariadb 프로세스 확인 [root@TestDB mariadb]# ps -ef |grep mysql root 67490 64178 0 13:36 pts/0 00:00:00 /bin/sh ./bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql mysql 67846 67490 20 13:36 pts/0 00:00:01 /usr/local/mariadb/bin/mariadbd --defaults-file=/etc/my.cnf --basedir=/usr/local/mariadb --datadir=/data/mariadb/DATA --plugin-dir=/usr/local/mariadb/lib/plugin --user=mysql --log-error=/data/mariadb/ADMIN/error.log --open-files-limit=65535 --pid-file=/data/mariadb/mysqld.pid --socket=/data/mariadb/TMP/mysql.sock --port=3306 root 67865 64178 0 13:36 pts/0 00:00:00 grep --color=auto mysql # root 패스워드 설정 [root@TestDB mariadb]# mysqladmin -uroot password 'mariadb123'; # mariadb 접속 [root@TestDB mariadb]# mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 6 Server version: 10.5.9-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. root@localhost:(none) 13:41:06>\s -------------- bin/mysql Ver 15.1 Distrib 10.5.9-MariaDB, for Linux (x86_64) using readline 5.1 Connection id: 7 Current database: Current user: root@localhost SSL: Not in use Current pager: less -n -i -F -X -E Using outfile: '' Using delimiter: ; Server: MariaDB Server version: 10.5.9-MariaDB-log MariaDB Server Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8 Db characterset: utf8 Client characterset: utf8 Conn. characterset: utf8 UNIX socket: /data/mariadb/TMP/mysql.sock Uptime: 5 min 19 sec Threads: 4 Questions: 13 Slow queries: 0 Opens: 19 Open tables: 13 Queries per second avg: 0.040 -------------- # 서비스등록 [root@TestDB mariadb]# cp /usr/local/mariadb/support-files/mysql.server /etc/init.d/mysqld [root@TestDB mariadb]# systemctl enable mysqld [root@TestDB mariadb]# chkconfig mysqld on [root@TestDB mariadb]# chkconfig --list Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. If you want to list systemd services use 'systemctl list-unit-files'. To see services enabled on particular target use 'systemctl list-dependencies [target]'. mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off network 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@TestDB mariadb]# systemctl status mysqld * mysqld.service - LSB: start and stop MariaDB Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled) Active: active (running) since Fri 2021-06-11 13:37:46 KST; 6 months 12 days ago Docs: man:systemd-sysv-generator(8) CGroup: /system.slice/mysqld.service |-94605 /bin/sh /usr/local/mariadb/bin/mysqld_safe --datadir=/data/mariadb/DATA --pid-file=/data/mariadb/mysqld.pid `-94978 /usr/local/mariadb/bin/mariadbd --basedir=/usr/local/mariadb --datadir=/data/mariadb/DATA --plugin-dir=/usr/local/mariadb/lib/plugin --user=mysql --log-error=/data/mariadb/ADMIN/error.log --open-file... Jun 11 13:37:43 TestDB systemd[1]: Starting LSB: start and stop MariaDB... Jun 11 13:37:43 TestDB mysqld[94323]: Starting MariaDB.210611 13:37:43 mysqld_safe Adding '/lib64/libtcmalloc_minimal.so.4' to LD_PRELOAD for mysqld Jun 11 13:37:43 TestDB mysqld[94323]: 210611 13:37:43 mysqld_safe Logging to '/data/mariadb/ADMIN/error.log'. Jun 11 13:37:43 TestDB mysqld[94323]: 210611 13:37:43 mysqld_safe Starting mariadbd daemon with databases from /data/mariadb/DATA Jun 11 13:37:46 TestDB mysqld[94323]: .. SUCCESS! Jun 11 13:37:46 TestDB systemd[1]: Started LSB: start and stop MariaDB. [root@TestDB ~]# # 설치완료 |
참조 :
- real mariadb 책
- https://mariadb.com/kb/en/documentation/
- https://mariadb.com/docs/
'DBMS > MySQL&Mariadb' 카테고리의 다른 글
MariaDB replication 구성 (0) | 2021.12.23 |
---|---|
MariaDB 권한 관리 (0) | 2021.12.23 |
MariaDB 사용자 관리 (0) | 2021.12.23 |
MariaDB 데이베이스 관리 (0) | 2021.12.23 |
MariaDB my.cnf 샘플 (0) | 2021.12.23 |