1. 소스컴파일에 필요한 라이브러리를 설치해준다
yum install cmake ncurses ncurses-devel bison gcc gcc-c++ -y
2. mariaDB 다운로드 및 설치 준비
cd /usr/local/src
wget -N https://downloads.mariadb.org/interstitial/mariadb-10.1.11/source/mariadb-10.1.11.tar.gz
tar zxvf mariadb-10.1.11.tar.gz
mkdir build
cd build
3. 컴파일
DCMAKE_INSTALL_PREFIX에 설치경로 입력
DMYSQL_DATADIR에 DB 저장 경로
cmake -DWITH_READLINE=1 -DWITH_READLINE=1 -DWITH_SSL=bundled -DWITH_ZLIB=system -DDEFAULT_CHARSET=euckr -DDEFAULT_COLLATION=euckr_korean_ci -DENABLED_LOCAL_INFILE=1 -DWITH_EXTRA_CHARSETS=all -DWITH_ARIA_STORAGE_ENGINE=1 -DWITH_XTRADB_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_FEDERATEDX_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DCMAKE_INSTALL_PREFIX=/usr/local/infra911/ -DMYSQL_DATADIR=/usr/local/infra911/common/mysql
4. 설치(시간이 오래걸립니다 기다려주세요 커피한잔하시면서...)
make;make install;
5. 설정파일 복사
cp /usr/local/infra911/common/mariadb/support-files/my-innodb-heavy-4G.cnf /usr/local/infra911/common/mariadb/my.cnf
6. mysql 계정 mariadb 권한 설정
chown mysql.mysql /usr/local/infra911/common/mariadb_10.1.11 -R
7. edite /etc/my.cnf
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
default-character-set=euckr
[mysqld]
innodb_file_per_table=0
skip-external-locking
skip-name-resolve
skip-host-cache
max_allowed_packet = 128M
net_buffer_length=1M
port = 3306
socket = /tmp/mysql.sock
key_buffer_size = 64M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size = 32M
net_buffer_length = 64K
read_buffer_size = 8M
read_rnd_buffer_size = 16M
myisam_sort_buffer_size = 8M
max_connections = 512
character-set-server=euckr
collation-server=euckr_korean_ci
init_connect=set collation_connection=euckr_korean_ci
init_connect=set names euckr
character-set-client-handshake=false
skip-character-set-client-handshake
#log-bin=mysql-bin
#binlog_format=mixed
server-id = 1
thread_cache_size = 4
thread_concurrency = 4
# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /usr/local/infra911/common/mariadb/var/
innodb_data_file_path = ibdata1:20G
innodb_log_group_home_dir = /usr/local/infra911/common/mariadb/var/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 2G
innodb_additional_mem_pool_size = 16M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_files_in_group = 3
innodb_log_file_size = 256M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 10
# Option for Performance
innodb_file_io_threads = 16
innodb_thread_concurrency = 16
thread_stack = 512K
[mysqldump]
quick
max_allowed_packet = 128M
default-character-set=euckr
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
default-character-set=euckr
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
8. DB 생성
/usr/local/infra911/common/mariadb/scripts/mysql_install_db --user=mysql --basedir=/usr/local/infra911/common/mariadb --datadir=/usr/local/infra911/common/mariadb/var
9. mariadb start
/bin/echo -n " Starting Database Server..."
cd /usr/local/infra911/common/mariadb
./bin/mysqld_safe --skip-log-warnings 2>&1 > /dev/null &
10. mysql 사용자 계정생성
cd /usr/local/infra911/common/mariadb/bin
./mysql -uroot
use mysql;
update user set password=password('infra911pw') where user='root';
flush privileges;
사용자 추가
use mysql;
create user infra911@localhost identified by 'infra911pw';
create user 'infra911'@'%' identified by 'infra911pw';
create user cable911@localhost identified by 'cable911pw';
create user 'cable911'@'%' identified by 'cable911pw';
모든 db에 사용자 권한 부여
grant all privileges on *.* to infra911@localhost identified by 'infra911pw' with grant option;
grant all privileges on *.* to cable911@localhost identified by 'cable911pw' with grant option;
grant all privileges on *.* to infra911@'%' identified by 'infra911pw' with grant option;
grant all privileges on *.* to cable911@'%' identified by 'cable911pw' with grant option;
flush privileges;
euckr_korean_ci
/usr/local/infra911/common/mariadb/bin/mysql -uinfra911 -pinfra911pw INFRA911 < /root/backup/infra911.sql
/usr/local/infra911/common/mariadb/bin/mysql -uinfra911 -pinfra911pw INFRA911 < /root/backup/infra911.sql
/usr/local/infra911/common/mariadb/bin/mysql: Collation 'euckr_general_ci' is not a compiled collation and is not specified in the '/usr/local/infra911/common/mariadb/share/charsets/Index.xml' file
/usr/local/infra911/common/mariadb/bin/mysql -uinfra911 -pinfra911pw INFRA911 < /root/backup/infra911.sql
############## MariaDB rpm 설치 ##############################
[root@zetawiki ~]# rpm -qa | grep MariaDB
→ 설치 안됨
repo 설정[편집]
16px-Crystal_Clear_app_xmag.svg.png MariaDB.repo 설정 문서를 참고하십시오.
설치[편집]
[root@zetawiki ~]#vi /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1.10/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
[root@Cent6 yum.repos.d]# yum install MariaDB-server MariaDB-client
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: centos.tt.co.kr
* extras: ftp.daumkakao.com
* updates: ftp.daumkakao.com
mariadb | 2.9 kB 00:00
mariadb/primary_db | 18 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 3.3 MB 00:00
Resolving Dependencies
--> Running transaction check
---> Package MariaDB-client.x86_64 0:10.1.10-1.el6 will be obsoleting
--> Processing Dependency: MariaDB-common for package: MariaDB-client-10.1.10-1.el6.x86_64
---> Package MariaDB-server.x86_64 0:10.1.10-1.el6 will be installed
--> Processing Dependency: galera for package: MariaDB-server-10.1.10-1.el6.x86_64
--> Processing Dependency: perl(DBI) for package: MariaDB-server-10.1.10-1.el6.x86_64
--> Processing Dependency: libjemalloc.so.1()(64bit) for package: MariaDB-server-10.1.10-1.el6.x86_64
---> Package mysql.x86_64 0:5.1.73-5.el6_6 will be obsoleted
--> Processing Dependency: mysql = 5.1.73-5.el6_6 for package: mysql-devel-5.1.73-5.el6_6.x86_64
--> Running transaction check
---> Package MariaDB-common.x86_64 0:10.1.10-1.el6 will be installed
--> Processing Dependency: MariaDB-compat for package: MariaDB-common-10.1.10-1.el6.x86_64
---> Package MariaDB-devel.x86_64 0:10.1.10-1.el6 will be obsoleting
---> Package galera.x86_64 0:25.3.9-1.rhel6.el6 will be installed
--> Processing Dependency: nmap for package: galera-25.3.9-1.rhel6.el6.x86_64
---> Package jemalloc.x86_64 0:3.6.0-1.el6 will be installed
---> Package mysql-devel.x86_64 0:5.1.73-5.el6_6 will be obsoleted
---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed
--> Running transaction check
---> Package MariaDB-compat.x86_64 0:10.1.10-1.el6 will be obsoleting
---> Package mysql-libs.x86_64 0:5.1.73-5.el6_6 will be obsoleted
---> Package nmap.x86_64 2:5.51-4.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================
Installing:
MariaDB-client x86_64 10.1.10-1.el6 mariadb 40 M
replacing mysql.x86_64 5.1.73-5.el6_6
MariaDB-compat x86_64 10.1.10-1.el6 mariadb 2.7 M
replacing mysql-libs.x86_64 5.1.73-5.el6_6
MariaDB-devel x86_64 10.1.10-1.el6 mariadb 6.9 M
replacing mysql-devel.x86_64 5.1.73-5.el6_6
MariaDB-server x86_64 10.1.10-1.el6 mariadb 103 M
Installing for dependencies:
MariaDB-common x86_64 10.1.10-1.el6 mariadb 42 k
galera x86_64 25.3.9-1.rhel6.el6 mariadb 8.9 M
jemalloc x86_64 3.6.0-1.el6 mariadb 99 k
nmap x86_64 2:5.51-4.el6 base 2.8 M
perl-DBI x86_64 1.609-4.el6 base 705 k
Transaction Summary
====================================================================================================================================
Install 9 Package(s)
Downloading Packages:
(1/9): MariaDB-10.1.10-centos6-x86_64-client.rpm | 40 MB 00:14
(2/9): MariaDB-10.1.10-centos6-x86_64-common.rpm | 42 kB 00:00
(3/9): MariaDB-10.1.10-centos6-x86_64-compat.rpm | 2.7 MB 00:01
(4/9): MariaDB-10.1.10-centos6-x86_64-devel.rpm | 6.9 MB 00:03
(5/9): MariaDB-10.1.10-centos6-x86_64-server.rpm | 103 MB 00:47
(6/9): galera-25.3.9-1.rhel6.el6.x86_64.rpm | 8.9 MB 00:10
(7/9): jemalloc-3.6.0-1.el6.x86_64.rpm | 99 kB 00:00
(8/9): nmap-5.51-4.el6.x86_64.rpm | 2.8 MB 00:00
(9/9): perl-DBI-1.609-4.el6.x86_64.rpm | 705 kB 00:00
------------------------------------------------------------------------------------------------------------------------------------
Total 2.1 MB/s | 165 MB 01:19
warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID 1bb943db: NOKEY
Retrieving key from https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
Importing GPG key 0x1BB943DB:
Userid: "MariaDB Package Signing Key <package-signing-key@mariadb.org>"
From : https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : MariaDB-common-10.1.10-1.el6.x86_64 1/12
warning: /etc/my.cnf created as /etc/my.cnf.rpmnew
Installing : MariaDB-compat-10.1.10-1.el6.x86_64 2/12
Installing : MariaDB-client-10.1.10-1.el6.x86_64 3/12
Installing : 2:nmap-5.51-4.el6.x86_64 4/12
Installing : galera-25.3.9-1.rhel6.el6.x86_64 5/12
Installing : jemalloc-3.6.0-1.el6.x86_64 6/12
Installing : perl-DBI-1.609-4.el6.x86_64 7/12
Installing : MariaDB-server-10.1.10-1.el6.x86_64 8/12
chown: cannot access `/var/lib/mysql': No such file or directory
2016-02-05 14:32:21 140238286628896 [Note] /usr/sbin/mysqld (mysqld 10.1.10-MariaDB) starting as process 10720 ...
2016-02-05 14:32:22 7f8bc5422820 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
Installation of system tables failed! Examine the logs in
/var/lib/mysql for more information.
The problem could be conflicting information in an external
my.cnf files. You can ignore these by doing:
shell> /usr/bin/scripts/mysql_install_db --defaults-file=~/.my.cnf
You can also try to start the mysqld daemon with:
shell> /usr/sbin/mysqld --skip-grant --general-log &
and use the command line tool /usr/bin/mysql
to connect to the mysql database and look at the grant tables:
shell> /usr/bin/mysql -u root mysql
mysql> show tables;
Try 'mysqld --help' if you have problems with paths. Using
--general-log gives you a log in /var/lib/mysql that may be helpful.
The latest information about mysql_install_db is available at
https://mariadb.com/kb/en/installing-system-tables-mysql_install_db
MariaDB is hosted on launchpad; You can find the latest source and
email lists at http://launchpad.net/maria
Please check all of the above before submitting a bug report
at http://mariadb.org/jira
Installing : MariaDB-devel-10.1.10-1.el6.x86_64 9/12
Erasing : mysql-devel-5.1.73-5.el6_6.x86_64 10/12
Erasing : mysql-5.1.73-5.el6_6.x86_64 11/12
Erasing : mysql-libs-5.1.73-5.el6_6.x86_64 12/12
Verifying : MariaDB-client-10.1.10-1.el6.x86_64 1/12
Verifying : galera-25.3.9-1.rhel6.el6.x86_64 2/12
Verifying : MariaDB-server-10.1.10-1.el6.x86_64 3/12
Verifying : perl-DBI-1.609-4.el6.x86_64 4/12
Verifying : jemalloc-3.6.0-1.el6.x86_64 5/12
Verifying : MariaDB-compat-10.1.10-1.el6.x86_64 6/12
Verifying : MariaDB-devel-10.1.10-1.el6.x86_64 7/12
Verifying : 2:nmap-5.51-4.el6.x86_64 8/12
Verifying : MariaDB-common-10.1.10-1.el6.x86_64 9/12
Verifying : mysql-libs-5.1.73-5.el6_6.x86_64 10/12
Verifying : mysql-5.1.73-5.el6_6.x86_64 11/12
Verifying : mysql-devel-5.1.73-5.el6_6.x86_64 12/12
Installed:
MariaDB-client.x86_64 0:10.1.10-1.el6 MariaDB-compat.x86_64 0:10.1.10-1.el6 MariaDB-devel.x86_64 0:10.1.10-1.el6
MariaDB-server.x86_64 0:10.1.10-1.el6
Dependency Installed:
MariaDB-common.x86_64 0:10.1.10-1.el6 galera.x86_64 0:25.3.9-1.rhel6.el6 jemalloc.x86_64 0:3.6.0-1.el6 nmap.x86_64 2:5.51-4.el6
perl-DBI.x86_64 0:1.609-4.el6
Replaced:
mysql.x86_64 0:5.1.73-5.el6_6 mysql-devel.x86_64 0:5.1.73-5.el6_6 mysql-libs.x86_64 0:5.1.73-5.el6_6
Complete!
확인 2[편집]
[root@zetawiki ~]# rpm -qa | grep MariaDB
MariaDB-server-5.5.34-1
MariaDB-common-5.5.34-1
MariaDB-client-5.5.34-1
DB 시작 / 패스워드 변경[편집]
아까 나왔던 안내대로 DB를 시작하고 패스워드를 바꾼다.
############### vi /etc/my.cnf 편집 #########################
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
default-character-set=euckr
[mysqld]
innodb_file_per_table=0
skip-external-locking
skip-name-resolve
skip-host-cache
port = 3306
socket = /tmp/mysql.sock
key_buffer_size = 64M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size = 32M
net_buffer_length = 64K
read_buffer_size = 8M
read_rnd_buffer_size = 16M
myisam_sort_buffer_size = 8M
max_connections = 512
character-set-server=euckr
collation-server=euckr_korean_ci
init_connect=set collation_connection=euckr_korean_ci
init_connect=set names euckr
character-set-client-handshake=false
skip-character-set-client-handshake
#log-bin=mysql-bin
#binlog_format=mixed
server-id = 1
thread_cache_size = 4
thread_concurrency = 4
# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /usr/local/infra911/common/mariadb/var/
innodb_data_file_path = ibdata1:20G
innodb_log_group_home_dir = /usr/local/infra911/common/mariadb/var/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 2G
innodb_additional_mem_pool_size = 16M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_files_in_group = 3
innodb_log_file_size = 256M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 10
# Option for Performance
innodb_file_io_threads = 16
innodb_thread_concurrency = 16
thread_stack = 512K
[mysqldump]
quick
max_allowed_packet = 16M
default-character-set=euckr
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
default-character-set=euckr
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
#############################################################################################
[root@zetawiki ~]# service mysql start
Starting MySQL.. [ OK ]
[root@zetawiki ~]# /usr/bin/mysqladmin -u root password 'P@ssw0rd'
[root@zetawiki ~]# netstat -anp | grep 3306
tcp 0 0 :::3306 :::* LISTEN 18379/mysqld
서비스 등록도 mysql이란 이름으로 되어 있고, 포트도 3306, 데몬이름도 mysqld이다.
접속 확인[편집]
[root@zetawiki ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.34-MariaDB MariaDB Server
Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> quit
Bye
[root@zetawiki ~]#
부팅시 자동시작 설정[편집]
기본으로 설정되어 있지만 한번 더 확인
[root@zetawiki ~]# chkconfig mysql on
[root@zetawiki ~]# chkconfig --list mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
같이 보기[편집]
'네트워크' 카테고리의 다른 글
Alteon Layer 4 Switch Simple Manual (0) | 2019.10.14 |
---|---|
HSRP, VRRP, GLBP란 (0) | 2018.11.14 |
VRRP 설정 (0) | 2018.11.14 |
VRRP 설정 (0) | 2018.11.14 |