OS : Rocky linux 8.8
mariadb yum install
1. yum.repo 파일을 자동으로 다운로드 및 생성
1 |
[root@han ~]# curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version="mariadb-10.11" |
2. 파일 확인
1 2 |
[root@han ~]# ls -l /etc/yum.repos.d/mariadb.repo -rw-r--r-- 1 root root 780 9월 26 15:54 /etc/yum.repos.d/mariadb.repo |
3. mariadb install
1 |
[root@han ~]# yum install MariaDB-client MariaDB-connect-engine mariadb-devel mariadb-server |
4. 서비스 활성회 및 서비스 시작
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
### 서비스 시작시 자동시작 [root@han ~]# systemctl enable mariadb Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service. ### 서비스 시작 [root@han ~]# systemctl start mariadb ### 서비스 시작 확인 [root@han ~]# systemctl status mariadb ● mariadb.service - MariaDB 11.1.2 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 Tue 2023-09-26 15:59:26 KST; 2min 52s ago |
5. mysql 접속
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
[root@han ~]# mysql mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 11.1.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)]> \s -------------- mysql from 11.1.2-MariaDB, client 15.2 for Linux (x86_64) using readline 5.1 Connection id: 3 Current database: Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server: MariaDB Server version: 11.1.2-MariaDB MariaDB Server Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: latin1 Db characterset: latin1 Client characterset: utf8mb3 Conn. characterset: utf8mb3 UNIX socket: /var/lib/mysql/mysql.sock Uptime: 3 min 59 sec Threads: 1 Questions: 4 Slow queries: 0 Opens: 17 Open tables: 10 Queries per second avg: 0.016 MariaDB [(none)]> SELECT engine, support FROM information_schema.engines; +--------------------+---------+ | engine | support | +--------------------+---------+ | CSV | YES | | MRG_MyISAM | YES | | MEMORY | YES | | Aria | YES | | MyISAM | YES | | CONNECT | YES | | SEQUENCE | YES | | InnoDB | DEFAULT | | PERFORMANCE_SCHEMA | YES | +--------------------+---------+ 9 rows in set (0.000 sec) |
6. mysql root 패스워드 설정
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
MariaDB [(none)]> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MariaDB [mysql]> select host,user,password from user; +----------------+-------------+----------+ | Host | User | Password | +----------------+-------------+----------+ | localhost | mariadb.sys | | | localhost | root | invalid | | localhost | mysql | invalid | | | PUBLIC | | | localhost | | | | han.icomis.com | | | +----------------+-------------+----------+ 6 rows in set (0.001 sec) MariaDB [mysql]> alter user root@localhost identified via mysql_native_password using password("qwer1234"); MariaDB [mysql]> flush privileges; Query OK, 0 rows affected (0.000 sec) |
7. my.cnf 수정 ( default-engine-myisam )
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
[root@han ~]# vi /etc/my.cnf.d/server.cnf [mysqld] #dns query skip-name-resolve #connection max_connections = 1000 max_connect_errors = 1000 wait_timeout= 60 ### character character-set-server=utf8mb4 collation-server=utf8mb4_unicode_ci skip-character-set-client-handshake # symbolic-links=0 ##timestamp explicit_defaults_for_timestamp ### MyISAM Spectific options default-storage-engine = myisam key_buffer_size = 32M bulk_insert_buffer_size = 64M myisam_sort_buffer_size = 128M myisam_max_sort_file_size = 10G myisam_repair_threads = 1 [mysqldump] default-character-set = utf8 max_allowed_packet = 512M |
default-engine-innodb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
[mysqld] #dns query skip-name-resolve #connection max_connections = 1000 max_connect_errors = 1000 wait_timeout= 60 ### character character-set-server=utf8mb4 collation-server=utf8mb4_unicode_ci skip-character-set-client-handshake # symbolic-links=0 ##timestamp explicit_defaults_for_timestamp [mysqldump] default-character-set = utf8 max_allowed_packet = 512M |
8. mysql-client.cnf 수정
1 2 3 4 5 6 7 |
[root@han ~]# vi /etc/my.cnf.d/mysql-clients.cnf [client] default-character-set = utf8mb4 [mysql] default-character-set = utf8mb4 |
9. mysql 재시작
1 |
[root@han ~]# systemctl restart mariadb |
10. 환경설정 확인
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
[root@han ~]# mariadb -u root -p mysql Enter password: MariaDB [mysql]> \s -------------- mysql from 11.1.2-MariaDB, client 15.2 for Linux (x86_64) using readline 5.1 Connection id: 6 Current database: mysql Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server: MariaDB Server version: 11.1.2-MariaDB MariaDB Server Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8mb4 Db characterset: latin1 Client characterset: utf8mb4 Conn. characterset: utf8mb4 UNIX socket: /var/lib/mysql/mysql.sock Uptime: 3 min 10 sec MariaDB [mysql]> show variables like '%character%'; +--------------------------+------------------------------+ | Variable_name | Value | +--------------------------+------------------------------+ | character_set_client | utf8mb4 | | character_set_connection | utf8mb4 | | character_set_database | latin1 | | character_set_filesystem | binary | | character_set_results | utf8mb4 | | character_set_server | utf8mb4 | | character_set_system | utf8mb3 | | character_sets_dir | /usr/share/mariadb/charsets/ | +--------------------------+------------------------------+ 8 rows in set (0.001 sec) |
Server characterset : 데이터 베이스 생성시 기본값이 없을 경우, 이 값으로 캐릭터셋 설정
DB characterset : 테이블 생성시 기본값이 없을 경우, 이 값으로 캐릭터셋 설정
Client characterset : 클라이언트 인코딩 설정