1. MySQL 데이타베이스 백업.

[root@server ~]#  mysqldump --all-databases --user=root --password --master-data > backupdatabase.sql

Enter password: 

-- Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.


2. MySQL 서비스 중지.

[root@server ~]# service mysqld stop

Stopping mysqld:                                           [  OK  ]

[root@server ~]# chkconfig mysqld off


3. MySQL 관련 패키지 삭제

[root@server ~]# yum remove mysql


4. MariaDB 설치

https://downloads.mariadb.org/mariadb/repositories/#mirror=kaist 에서 자신의 OS에 맞는 MariaDB Repository를 확인한다.

MariaDB 10.0 버전 설치시 CentOS 6의 32비트와 64비트의 MariaDB Repository는 다음과 같다.

/etc/yum.repos.d/MariaDB.repo를 생성한 후 다음 내용을 복사해서 넣고 저장한다.


CentOS6 64비트

# MariaDB 10.0 CentOS repository list - created 2014-04-07 04:12 UTC

# http://mariadb.org/mariadb/repositories/

[mariadb]

name = MariaDB

baseurl = http://yum.mariadb.org/10.0/centos6-amd64

gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1


CentOS6 32비트

# MariaDB 10.0 CentOS repository list - created 2014-04-07 04:13 UTC

# http://mariadb.org/mariadb/repositories/

[mariadb]

name = MariaDB

baseurl = http://yum.mariadb.org/10.0/centos6-x86

gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1


지금까지는 MariaDB 설치를 위한 준비작업이었고, 이제 MariaDB를 인스톨한다.

[root@server ~]# yum install MariaDB MariaDB-client


5. MariaDB 서비스 시작

[root@server ~]# service mysql start

Starting MySQL...... SUCCESS! 

[root@server ~]# chkconfig mysql on


6.  MariaDB 업그레이드 

구버전의 MySQL을 MariaDB 10.0 버전으로 업그레이드 했을 경우에 테이블 구조가 달라 여러가지 에러가 발생한다. 따라서 다음 명령어를 통해서 업그레이드를 진행한다.

mysql_upgrade -u root -p


※ MariaDB 서비스가 실행되지 않을때!!

service mysql start 를 해서 곧바로 실행이 되면 가장 행복하겠지만, 실행이 되지 않을 때가 있다. 

여러가지 원인이 있을수 있겠지만, MySQL을 MariaDB로 마이그레이션 한 직후에 mysql 서비스가 실행이 되지 않고, 다음과 같은 에러를 볼수 있다면! (로그는 /var/lib/mysql 에 보면 ls *.err 로 찾아보면 볼수 있다)

140408  1:37:36 [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a diffe

rent size 640 pages (rounded down to MB) than specified in the .cnf file: initia

l 768 pages, max 0 (relevant if non-zero) pages!

140408  1:37:36 [ERROR] InnoDB: Could not open or create the system tablespace. 

If you tried to add new data files to the system tablespace, and it failed here,

 you should now edit innodb_data_file_path in my.cnf back to what it was, and re

move the new ibdata files InnoDB created in this failed attempt. InnoDB only wro

te those files full of zeros, but did not yet use them in any way. But be carefu

l: do not remove old data files which contain your precious data!

140408  1:37:36 [ERROR] Plugin 'InnoDB' init function returned error.

140408  1:37:36 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

140408  1:37:36 [Note] Plugin 'FEEDBACK' is disabled.

140408  1:37:36 [ERROR] Unknown/unsupported storage engine: InnoDB

140408  1:37:36 [ERROR] Aborting


위와 같은 문제가 생긴다면 다음 명령어를 입력해주시면 해결이 됩니다.

cd /var/lib/mysql/ && mkdir temp_bak/ && mv ib* temp_bak/

service mysql start



//