Mariadb 10.1.17 INSTALL / O/S : CentOS 6.x (64bit)
1. mariadb 10.1.17 버전을 설치하기 위해서는 boost 라이브러리가 필요하다 파일은 같은 디록토리 내에서 받고 압축을 풀고
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 |
[root@localhost ~]# yum -y install gcc gcc-c++ ncurses ncurses-devel cmake [root@localhost ~]# wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz [root@localhost ~]# tar xvfz boost_1_59_0.tar.gz [root@localhost ~]# wget mirror.koreaidc.com/mariadb/mariadb-10.1.17.tar.gz [root@localhost ~]# tar xvfz mariadb-10.1.17.tar.gz [root@localhost ~]# cd mariadb-10.1.17 [root@localhost mariadb-10.1.17]# cmake \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DWITH_EXTRA_CHARSETS=all \ -DMYSQL_DATADIR=/free/mysql_data \ -DENABLED_LOCAL_INFILE=1 \ -DDOWNLOAD_BOOST=1 \ -DWITH_BOOST=../boost_1_59_0 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_FEDERATED_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DSYSCONFDIR=/etc \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EXTRA_CHARSETS=all |
2. make / make install 을 진행한다 ( make 작업시 cpu 코어갯수대로 진행을 할수 있게 옵션을 줘서 진행)
1 2 3 |
[root@localhost mariadb-10.1.17]# make -j `grep processor /proc/cpuinfo' | wc -l` [root@localhost mariadb-10.1.17]# make install |
3. mysql 사용자 추가 및 권한 설정 / 환경설정 파일 복사
1 2 3 4 5 6 7 8 9 10 11 12 13 |
[root@localhost mariadb-10.1.17]# useradd -M mysql -u 27 >& /dev/null [root@localhost mariadb-10.1.17]# chown -R root:mysql /usr/local/mysql [root@localhost mariadb-10.1.17]# cd /usr/local/mysql [root@localhost mysql]# chmod 700 support-files/mysql.server [root@localhost mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysql [root@localhost mysql]# ln -s /etc/rc.d/init.d/mysql /etc/rc.d/rc3.d/S97mysql [root@localhost mysql]# cp support-files/mysql.server /usr/bin/ |
4. my.cnf 파일을 작성한다 ( default engine myisam ) / 만약 innodb 를 하려면 5번 항목으로
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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
[root@localhost mysql]# vi /etc/my.cnf [client] default-character-set = utf8 port = 3306 socket = /tmp/mysql.sock default-character-set = utf8 [mysqld] socket=/tmp/mysql.sock datadir=/free/mysql_data basedir = /usr/local/mysql #user = mysql #bind-address = 0.0.0.0 # skip-external-locking key_buffer_size = 384M max_allowed_packet = 1M table_open_cache = 512 sort_buffer_size = 2M read_buffer_size = 2M read_rnd_buffer_size = 8M myisam_sort_buffer_size = 64M thread_cache_size = 8 query_cache_size = 32M #dns query skip-name-resolve #connection max_connections = 1000 max_connect_errors = 1000 wait_timeout= 60 #slow-queries #slow_query_log = /free/mysql_data/slow-queries.log #long_query_time = 3 #log-slow-queries = /free/mysql_data/mysql-slow-queries.log ##timestamp explicit_defaults_for_timestamp symbolic-links=0 ### log log-error=/free/mysql_data/mysqld.log pid-file=/tmp/mysqld.pid ###chracter character-set-client-handshake=FALSE init_connect = SET collation_connection = utf8_general_ci init_connect = SET NAMES utf8 character-set-server = utf8 collation-server = utf8_general_ci symbolic-links=0 ##Password Policy #validate_password_policy=LOW #validate_password_policy=MEDIUM ### 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 ### INNODB Spectific options #default-storage-engine = InnoDB #skip-innodb #innodb_additional_mem_pool_size = 16M #innodb_buffer_pool_size = 1024MB #innodb_data_file_path = ibdata1:10M:autoextend #innodb_write_io_threads = 8 #innodb_read_io_threads = 8 #innodb_thread_concurrency = 16 #innodb_flush_log_at_trx_commit = 1 #innodb_log_buffer_size = 8M #innodb_log_file_size = 128M #innodb_log_files_in_group = 3 #innodb_max_dirty_pages_pct = 90 #innodb_lock_wait_timeout = 120 [mysqldump] default-character-set = utf8 max_allowed_packet = 16M [mysql] no-auto-rehash default-character-set = utf8 [myisamchk] key_buffer_size = 256M sort_buffer_size = 256M read_buffer = 2M write_buffer = 2M |
5. my.cnf 파일을 작성한다 ( 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 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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
[client] default-character-set = utf8 port = 3306 socket = /tmp/mysql.sock default-character-set = utf8 [mysqld] socket=/tmp/mysql.sock datadir=/free/mysql_data basedir = /usr/local/mysql #user = mysql #bind-address = 0.0.0.0 skip-external-locking key_buffer_size = 384M max_allowed_packet = 1M table_open_cache = 512 sort_buffer_size = 2M read_buffer_size = 2M read_rnd_buffer_size = 8M myisam_sort_buffer_size = 64M thread_cache_size = 8 query_cache_size = 32M #dns query skip-name-resolve #connection max_connections = 1000 max_connect_errors = 1000 wait_timeout= 60 #slow-queries #slow_query_log = /free/mysql_data/slow-queries.log #long_query_time = 3 #log-slow-queries = /free/mysql_data/mysql-slow-queries.log ##timestamp explicit_defaults_for_timestamp symbolic-links=0 ### log log-error=/free/mysql_data/mysqld.log pid-file=/tmp/mysqld.pid ###chracter character-set-client-handshake=FALSE init_connect = SET collation_connection = utf8_general_ci init_connect = SET NAMES utf8 character-set-server = utf8 collation-server = utf8_general_ci symbolic-links=0 ##Password Policy #validate_password_policy=LOW #validate_password_policy=MEDIUM ### 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 ### INNODB Spectific options default-storage-engine = InnoDB #skip-innodb #innodb_additional_mem_pool_size = 16M innodb_buffer_pool_size = 1024MB innodb_data_file_path = ibdata1:10M:autoextend innodb_write_io_threads = 8 innodb_read_io_threads = 8 innodb_thread_concurrency = 16 innodb_flush_log_at_trx_commit = 1 innodb_log_buffer_size = 8M innodb_log_file_size = 128M innodb_log_files_in_group = 3 innodb_max_dirty_pages_pct = 90 innodb_lock_wait_timeout = 120 [mysqldump] default-character-set = utf8 max_allowed_packet = 16M [mysql] no-auto-rehash default-character-set = utf8 [myisamchk] key_buffer_size = 256M sort_buffer_size = 256M read_buffer = 2M write_buffer = 2M |
6. mysql database install / 권환변경
1 2 3 4 5 |
[root@localhost mysql]# cd /usr/local/mysql [root@localhost mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/free/mysql_data [root@localhost mysql]# chown -R mysql /free/mysql_data/ |
7. 실제 해당 디렉토리에 mysql install 되었는지 확인하자
1 2 3 4 5 6 7 8 9 10 11 12 13 |
[root@localhost mysql]# ll /free/mysql_data/ 합계 110656 -rw-rw---- 1 mysql mysql 16384 2016-09-09 10:23 aria_log.00000001 -rw-rw---- 1 mysql mysql 52 2016-09-09 10:23 aria_log_control -rw-rw---- 1 mysql mysql 50331648 2016-09-09 10:23 ib_logfile0 -rw-rw---- 1 mysql mysql 50331648 2016-09-09 10:23 ib_logfile1 -rw-rw---- 1 mysql mysql 12582912 2016-09-09 10:23 ibdata1 -rw-rw---- 1 mysql mysql 0 2016-09-09 10:23 multi-master.info drwx------ 2 mysql root 4096 2016-09-09 10:23 mysql -rw-rw---- 1 mysql mysql 7007 2016-09-09 10:23 mysqld.log drwx------ 2 mysql mysql 4096 2016-09-09 10:23 performance_schema -rw-rw---- 1 mysql mysql 24576 2016-09-09 10:23 tc.log drwx------ 2 mysql root 4096 2016-09-09 10:23 test |
8. 설치가 모두 완료되었으니 mysql 을 시작해 보자 / mysql start / 정상적으로 올라왔다
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 |
[root@localhost ~]# mysql.server start Starting MySQL. SUCCESS! [root@localhost mysql]# /usr/local/mysql/bin/mysql -V /usr/local/mysql/bin/mysql Ver 15.1 Distrib 10.1.17-MariaDB, for Linux (x86_64) using readline 5.1 [root@localhost mysql]# /usr/local/mysql/bin/mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 10.1.17-MariaDB Source distribution Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> \s -------------- /usr/local/mysql/bin/mysql Ver 15.1 Distrib 10.1.17-MariaDB, 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: 10.1.17-MariaDB Source distribution Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8 Db characterset: utf8 Client characterset: utf8 Conn. characterset: utf8 UNIX socket: /tmp/mysql.sock Uptime: 25 sec Threads: 1 Questions: 5 Slow queries: 0 Opens: 18 Flush tables: 1 Open tables: 11 Queries per second avg: 0.200 -------------- MariaDB [(none)]> |
9. mysql 5.7 버전의 경우 secret 파일이 별도 생성되어 패스워드를 입력해야 하나 mariadb의 경우 기본 패스워드가 존재하지 않는다
명령어를 이용하여 패스워드를 변경해주면 된다
1 2 |
[root@localhost mysql]# /usr/local/mysql/bin/mysqladmin -u root -p password qwer1234567890 Enter password: |