*** mariaDB 다운로드 및 설치 ***
# cd /usr/local/src
# wget https://downloads.mariadb.org/interstitial/mariadb-5.5.35/kvm-tarbake-jaunty-x86/mariadb-5.5.35.tar.gz/from/http://mirror.jmu.edu/pub/mariadb
# tar zxvf mariadb-5.5.35.tar.gz
# cd mariadb-5.5.35
# mkdir build
# cd build
# cmake .. \
-DCMAKE_INSTALL_PREFIX=/usr/local/mariadb \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/usr/local/mariadb/data \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FEDERATEDX_STORAGE_ENGINE=1 \
-DWITH_ARIA_STORAGE_ENGINE=1 \
-DWITH_XTRADB_STORAGE_ENGINE=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_ZLIB=system
# make;make install
* 사용자 등록
MariaDB 서버의 실행시킬 사용자를 생성한다.
# /usr/sbin/groupadd -g 27 -o -r mysql
# /usr/sbin/useradd -M -g mysql -o -r -d /usr/local/mariadb/data -s /bin/false -c "MariaDB Server" -u 27 mysql
※ 사용자를 mysql로 한것은 mariaDB는 MySQL과의 호환성으로 인하여 mysql로 하였습니다.
* 소유권 변경
# mkdir -p /usr/local/mariadb/InnoDB/redoLogs
# mkdir -p /usr/local/mariadb/InnoDB/undoLogs
# chown -R mysql /usr/local/mariadb/data
# chgrp -R mysql /usr/local/mariadb
# mkdir /usr/local/mariadb/logs /usr/local/mariadb/tmp
# chown mysql.mysql /usr/local/mariadb/tmp
# chown mysql.mysql /usr/local/mariadb/logs
# chown -R mysql:mysql /usr/local/mariadb/data
* 자동 실행 등록
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod 755 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# chkconfig --list | grep mysqld
* 시스템 테이블 생성
# cd /usr/local/mariadb
# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb --datadir=/usr/local/mariadb/data
* 라이브러리를 추가
# rm /etc/ld.so.conf.d/mysql-x86_64.conf 또는 rm /etc/ld.so.conf.d/mysql-i386.conf
# echo "/usr/local/mariadb/lib" > /etc/ld.so.conf.d/mysql.conf
* 64bit 라면 라이브러리를 위해서 심볼릭 링크
# cd /usr/local/mariadb
mariadb# ln -s lib lib64
# cd /usr/local/mariadb/support-files
# cp my-huge.cnf /etc/my.cnf
# chmod 755 /etc/init.d/mysqld
# /etc/init.d/mysqld start
※ 다른버전과 다르게 "character-set-server" 가 아닌 "character_set_server" 처럼 아래쪽라인 (_) 입니다.
이게 맞지 않을 경우 PID 에러라고 하면서 mysql이 실행되지 않을 수 있습니다.
* root 비밀번호 변경
# /usr/local/mariadb/bin/mysql -uroot -p
Enter password: (그냥 Enter 누르시면 됩니다.)
mysql> USE mysql;
mysql> UPDATE user SET password=password('new_password') WHERE user='root';
mysql> FLUSH privileges;
* 캐릭터셋 확인
mysql> show variables like 'c%';
+--------------------------+----------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql/share/charsets/ |
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
| completion_type | NO_CHAIN |
| concurrent_insert | AUTO |
| connect_timeout | 10 |
+--------------------------+----------------------------------+
14 rows in set (0.00 sec)
설치 작업이 끝났다면 익명접근권한을 삭제하자. ( mysql 콘솔에 그냥 접근을 못하게 해야 함.)
# /usr/local/mariadb/bin/mysql -u root -p
# Enter password:
# mysql> USE mysql;
# mysql> delete from user where password = "";
# mysql> exit
# /usr/local/mariadb/bin/mysqladmin -u root -p reload
# Enter password:
# cd /usr/local/src
# wget https://downloads.mariadb.org/interstitial/mariadb-5.5.35/kvm-tarbake-jaunty-x86/mariadb-5.5.35.tar.gz/from/http://mirror.jmu.edu/pub/mariadb
# tar zxvf mariadb-5.5.35.tar.gz
# cd mariadb-5.5.35
# mkdir build
# cd build
# cmake .. \
-DCMAKE_INSTALL_PREFIX=/usr/local/mariadb \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/usr/local/mariadb/data \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FEDERATEDX_STORAGE_ENGINE=1 \
-DWITH_ARIA_STORAGE_ENGINE=1 \
-DWITH_XTRADB_STORAGE_ENGINE=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_ZLIB=system
# make;make install
* 사용자 등록
MariaDB 서버의 실행시킬 사용자를 생성한다.
# /usr/sbin/groupadd -g 27 -o -r mysql
# /usr/sbin/useradd -M -g mysql -o -r -d /usr/local/mariadb/data -s /bin/false -c "MariaDB Server" -u 27 mysql
※ 사용자를 mysql로 한것은 mariaDB는 MySQL과의 호환성으로 인하여 mysql로 하였습니다.
* 소유권 변경
# mkdir -p /usr/local/mariadb/InnoDB/redoLogs
# mkdir -p /usr/local/mariadb/InnoDB/undoLogs
# chown -R mysql /usr/local/mariadb/data
# chgrp -R mysql /usr/local/mariadb
# mkdir /usr/local/mariadb/logs /usr/local/mariadb/tmp
# chown mysql.mysql /usr/local/mariadb/tmp
# chown mysql.mysql /usr/local/mariadb/logs
# chown -R mysql:mysql /usr/local/mariadb/data
* 자동 실행 등록
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod 755 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# chkconfig --list | grep mysqld
* 시스템 테이블 생성
# cd /usr/local/mariadb
# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb --datadir=/usr/local/mariadb/data
* 라이브러리를 추가
# rm /etc/ld.so.conf.d/mysql-x86_64.conf 또는 rm /etc/ld.so.conf.d/mysql-i386.conf
# echo "/usr/local/mariadb/lib" > /etc/ld.so.conf.d/mysql.conf
* 64bit 라면 라이브러리를 위해서 심볼릭 링크
# cd /usr/local/mariadb
mariadb# ln -s lib lib64
# cd /usr/local/mariadb/support-files
# cp my-huge.cnf /etc/my.cnf
# chmod 755 /etc/init.d/mysqld
# /etc/init.d/mysqld start
※ 다른버전과 다르게 "character-set-server" 가 아닌 "character_set_server" 처럼 아래쪽라인 (_) 입니다.
이게 맞지 않을 경우 PID 에러라고 하면서 mysql이 실행되지 않을 수 있습니다.
* root 비밀번호 변경
# /usr/local/mariadb/bin/mysql -uroot -p
Enter password: (그냥 Enter 누르시면 됩니다.)
mysql> USE mysql;
mysql> UPDATE user SET password=password('new_password') WHERE user='root';
mysql> FLUSH privileges;
* 캐릭터셋 확인
mysql> show variables like 'c%';
+--------------------------+----------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql/share/charsets/ |
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
| completion_type | NO_CHAIN |
| concurrent_insert | AUTO |
| connect_timeout | 10 |
+--------------------------+----------------------------------+
14 rows in set (0.00 sec)
설치 작업이 끝났다면 익명접근권한을 삭제하자. ( mysql 콘솔에 그냥 접근을 못하게 해야 함.)
# /usr/local/mariadb/bin/mysql -u root -p
# Enter password:
# mysql> USE mysql;
# mysql> delete from user where password = "";
# mysql> exit
# /usr/local/mariadb/bin/mysqladmin -u root -p reload
# Enter password:
'Code Snippets > db' 카테고리의 다른 글
mysql : 서버연결/종료 (0) | 2014.08.25 |
---|