Programming/version control

rocky9에 mariadb 11.2 설치 및 실행

사리생성 2023. 12. 26. 08:49

MariaDB 11.2.2 설치

https://mariadb.com/kb/en/mariadb-11-2-0-release-notes/

download 클릭.

 

Here is your custom MariaDB DNF/YUM repository entry for CentOS. Copy and paste it into a file under /etc/yum.repos.d 

(we suggest naming the file MariaDB.repo or something similar).

# MariaDB 11.2 CentOS repository list - created 2023-12-25 23:21 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
# rpm.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details.
# baseurl = https://rpm.mariadb.org/11.2/centos/$releasever/$basearch
baseurl = https://tw1.mirror.blendbyte.net/mariadb/yum/11.2/centos/$releasever/$basearch
module_hotfixes = 1
# gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB
gpgkey = https://tw1.mirror.blendbyte.net/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck = 1

 

sudo yum install MariaDB-server MariaDB-client

 

 

위에 내용들은 모두 사이트에 있는 내용이다. 따라서 해보자.

1. vi /etc/yum.repos.d/MariaDB.repo 파일을 열어서 위의 내용을 넣고 저장한다.

2. sudo yum install MariaDB-server MariaDB-client

 

3. 계속 y를 선택하면 어느세 설치 완료

 

MariaDB 실행

버전 확인.

[root@localhost yum.repos.d]# mariadb --version
mariadb from 11.2.2-MariaDB, client 15.2 for Linux (x86_64) using  EditLine wrapper

 

mariadb 실행

[root@localhost yum.repos.d]# systemctl start mariadb

 

mariadb 실행 확인

[root@localhost yum.repos.d]# ps -ef | grep mariadb
mysql      14124       1  0 08:39 ?        00:00:00 /usr/sbin/mariadbd
root       14139   12458  0 08:39 pts/0    00:00:00 grep --color=auto mariadb
[root@localhost yum.repos.d]# pstree | grep mariadb
        |-mariadbd---11*[{mariadbd}]
[root@localhost yum.repos.d]#

 

root 패스워드 적용

[root@localhost yum.repos.d]# mysqladmin -u root password
mysqladmin: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb-admin' instead
New password:
Confirm new password:
[root@localhost yum.repos.d]#

 

접속 확인

[root@localhost yum.repos.d]# mysql -u root -p
mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 11.2.2-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 |
| sys                |
| test               |
+--------------------+
5 rows in set (0.001 sec)

MariaDB [(none)]>

 

자동 실행 확인 및 등록

[root@localhost yum.repos.d]# systemctl is-enabled mariadb
disabled
[root@localhost yum.repos.d]# systemctl enable mariadb
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.
[root@localhost yum.repos.d]# systemctl is-enabled mariadb
enabled
[root@localhost yum.repos.d]#

 

 

DB 생성

CREATE DATABASE 데이터베이스명 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

 

유저생성

CREATE USER '아이디'@'%' IDENTIFIED BY '비밀번호';
GRANT ALL PRIVILEGES ON 데이터베이스.* TO '아이디'@'%';
FLUSH PRIVILEGES;

 

 

 

 

테이블 생성 및 스크립트 실행

 

MariaDB [tgroupware]> source /home/tomcat/tgroupware/tables.sql

ERROR 1064 (42000) at line 360 in file: '/home/tomcat/tgroupware/tables.sql': You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DELIMITER' at line 1

MariaDB [tgroupware]> source /home/tomcat/tgroupware/tableData.sql

 

테이블 소문자 , 대문자 구별.