헤르메스 LIFE

[MariaDB] MariaDB 설치 및 MySQL과의 호환성 본문

Database

[MariaDB] MariaDB 설치 및 MySQL과의 호환성

헤르메스의날개 2016. 3. 30. 11:12
728x90


출처 : http://www.mysqlkorea.com/gnuboard4/bbs/board.php?bo_table=develop_03&wr_id=67



- MariaDB  (http://mariadb.com) -

(1) 소개
  MySQL 개발자 미카엘 위데니우스에 의해 만들어진 MariaDB는
  MySQL이 MariaDB의 모태이며, Sun에서 가져온 DataBase입니다.
  그러므로 MySQL과 흡사합니다. 
  
 
 
(3) 설치
컴파일버전이 아닌 보다 high performance인 바이너리버전(64bit)으로 설치하겠습니다.
OS = CentOS 5.4
MariaDB버전 = mariadb-5.1.47
설치경로 = /home/csr
baserdir = /home/csr/mariadb
datadir = /home/csr/mariadb/data 
 
① 다운로드 및 압축해제
   shell> wget 'http://askmonty.org/downloads/r/http://ftp.rediris.es/mirror/MariaDB/mariadb-5.1.47/kvm-bintar-hardy-x86/mariadb-5.1.47-Linux-i686.tar.gz'
   shell> tar xvfz mariadb-5.1.47-Linux-i686.tar.gz -C /home/csr
 
② user , group 생성
   shell> groupadd mysql
   shell> useradd -g mysql mysql
 
③ 심벌릭링크 권한변경
   shell> ln -s mariadb-5.1.47-Linux-x86_64 mariadb
   shell> chown -R mysql.mysql /home/csr/mariadb-5.1.47-Linux-x86_64
 
④ my.cnf 생성및수정
   shell> cp /home/csr/mariadb/support-files/my-huge.cnf /home/csr/mariadb/my.cnf
   shell> vi my.cnf
 [client]
 #password       = your_password
 port            = 3306
 socket          = /tmp/mysql.sock
 # Here follows entries for some specific programs
 # The MySQL server
 [mysqld]
 port            = 3306
 socket          = /tmp/mysql.sock
 basedir         = /home/csr/mariadb
 datadir         = /home/csr/mariadb/data
 skip-external-locking
 
⑤ install db (datadir 생성)
  shell> /home/csr/mariadb-5.1.47-Linux-x86_64/script-xs/mysql_install_db --defaults-file=/home/csr/mariadb/my.cnf --user=mysql
 
⑥ mariaDB 데몬 start
  shell> /home/csr/mariadb/bin/mysqld_safe --defaults-file=/home/csr/mariadb/my.cnf --basedir=/home/csr/mariadb --datadir=/home/csr/mariadb/data --user=mysql &
 
⑦ mariaDB connect
  shell> /home/csr/mariadb/bin/mysql -uroot -p

MariaDB [mysql]> select version();
+--------------------+
| version()          |
+--------------------+
| 5.1.47-MariaDB-log |
+--------------------+
1 row in set (0.00 sec) 
 
⑧ Engine 확인
MariaDB [(none)]> show engines;
+---------------+----------+----------------------------------------+--------------
| Engine            | Support   | Comment                                             | Transactions 
+---------------+----------+--------------------------------------------+--------------
| BLACKHOLE    | YES        | /dev/null storage engine (anything you   | NO           
| MRG_MYISAM | YES        | Collection of identical MyISAM tables      | NO           
| FEDERATED    | YES        | FederatedX pluggable storage engine      | YES          
MARIA            | YES        | Crash-safe tables with MyISAM heritage  | YES          
| CSV               | YES        | CSV storage engine                               | NO           
| MEMORY        | YES        | Hash based, stored in memory, useful fo | NO           
| ARCHIVE        | YES        | Archive storage engine                           | NO           
| MyISAM         | DEFAULT | Default engine as of MySQL 3.23 with gr   | NO           
| InnoDB           | YES        | Supports transactions, and foreign keys    | YES          
PBXT             | YES        | High performance, multi-versioning tran    | YES          
+---------------+----------+----------------------------------------+--------------
10 rows in set (0.00 sec)
Engine중에 MySQL에서는 접하지 못했던 MARIA , PBXT 라는 Engine이 보입니다.
Transaction 지원도 InnoDB는 물론이고 MARIA , PBXT Engine도 지원하는걸로 보입니다.
(MARIA Engine은 현재 transaction을 지원하지않으나, 앞으로의 버전에서는 지원한다는뜻같습니다.)
아쉬운점은 foreign key지원이 MySQL과 동일하게 InnoDB만 지원하네요.
 
⑨ MARIA Engine 으로 table 생성 및 data insert
 
MariaDB [test]> CREATE TABLE `mariatable` (
    ->   `idx` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    ->   `name` VARCHAR(24) NOT NULL,
    ->   PRIMARY KEY (`idx`)
    -> ) ENGINE=MARIA DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> insert into mariatable(idx,name)values('','양택조');
Query OK, 1 row affected, 1 warning (0.00 sec)
 
MariaDB [test]> select * from mariatable;
+-----+--------+
| idx | name   |
+-----+--------+
|   1 | 양택조 |
+-----+--------+
1 row in set (0.00 sec)
 
MARIA Engine의 data file 확장자는 *.frm(스키마)  *.MAD(데이타)  *.MAI(인덱스) 입니다.
data file 확장자가 MyISAM 과 흡사합니다. 
 
⑩ partition 지원
MariaDB [test]> show plugin;
+--------------------------------+--------+--------------------+---------+---------+
| Name                           | Status | Type               | Library | License |
+--------------------------------+--------+--------------------+---------+---------+
| binlog                         | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| MyISAM                         | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
partition                      | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| ARCHIVE                        | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| BLACKHOLE                      | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| CSV                            | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| FEDERATED                      | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| MEMORY                         | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| MARIA                          | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| MRG_MYISAM                     | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| PBXT                           | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| PBXT_STATISTICS                | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| InnoDB                         | ACTIVE | STORAGE ENGINE     | NULL    | GPL     |
| INNODB_RSEG                    | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_BUFFER_POOL_PAGES       | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_BUFFER_POOL_PAGES_INDEX | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_BUFFER_POOL_PAGES_BLOB  | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_TRX                     | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_LOCKS                   | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_LOCK_WAITS              | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_CMP                     | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_CMP_RESET               | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_CMPMEM                  | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_CMPMEM_RESET            | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_TABLE_STATS             | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_INDEX_STATS             | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| XTRADB_ADMIN_COMMAND           | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_SYS_TABLES              | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| INNODB_SYS_INDEXES             | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
| XTRADB_ENHANCEMENTS            | ACTIVE | INFORMATION SCHEMA | NULL    | GPL     |
+--------------------------------+--------+--------------------+---------+---------+
 
 
⑪MySQL과의 호환성 
  MySQL과의 호환성이  대부분 되는듯 보입니다.(테스트진행중)
  또한 PHP에서도  mysql관련 함수들과 호환됩니다.
 
이상으로 MariaDB 바이러리버전 설치를 마치겠습니다.






728x90