Friday, 10 February 2017

Install MYSQL 5.6 using TARBALL on Linux server


Login to the server (Node1) – prepared in  Previous Blog



Verify any preinstalled MYSQL RPM on server. If yes remove it first using "rpm -ev <rpm name>"



Copy software to specific location on Node 2 and Unzip it


Create Group and user "mysql" on Server Along with its home directory “/home/mysql


Change home directory Ownership to MYSQL:MYSQL


Create Mysql binary path and copy software


UNTAR software using commandtar -xvzf mysql-advanced-5.6.26-linux-glibc2.5-x86_64.tar.gz

                       .
                       .
                       .

Create MySQL data and log directories. Also change ownership to mysql:mysql



Create socket file directory location/path and set ownership


Copy/create new my.cnf file at /etc [/etc/my.cnf]

[client]

port=3306 <------------------------------------ ( Check/Change the port )

socket=/var/run/mysql/mysql.sock <------------------------------ ( Create & Verify directory for socket file )

default-character-set=utf8

[mysqld]

port=3306

socket=/var/run/mysql/mysql.sock <------------------------------- ( Create & Verify directory for socket file )

datadir=/var/lib/mysql

collation_server=utf8_unicode_ci

character_set_server=utf8

expire_logs_days=7

log-error=/var/lib/mysql_logs/err-log/mysqld.log <----------------------------- ( Create & Verify directory for "log-error" )

#relay-log=/var/lib/mysql_logs/relay-log/Node2-relay-bin <--------------------- ( Create & Verify directory for "relay-log" )

max_connections=100

connect_timeout=120

max_connect_errors=10

table_open_cache=2048

max_allowed_packet=32M

binlog_cache_size=1M

transaction_isolation=REPEATABLE-READ

tmp_table_size=64M

#log-bin=/var/lib/mysql_logs/bin-log/Node2-bin-log <----------------------------- ( Create & Verify directory for "log-bin" )

binlog_format=mixed

slow_query_log=1

long_query_time=2

key_buffer_size=32M

bulk_insert_buffer_size=64M

myisam_sort_buffer_size=128M

myisam_max_sort_file_size=10G

myisam_repair_threads=1

myisam_recover=1

innodb_buffer_pool_size=500M

innodb_data_home_dir=/var/lib/mysql/ibdata <--------------- ( Create & Verify directory for "innodb_data_home_dir" )

innodb_data_file_path=ibdata1:10M:autoextend

innodb_file_per_table=1

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_group_home_dir=/var/lib/mysql_logs/ibdata-log <------------------------------- ( Create & Verify directory for "innodb_log_group_home_dir" )

innodb_log_file_size=256M

innodb_log_files_in_group=3

innodb_max_dirty_pages_pct=90

innodb_lock_wait_timeout=120

server-id=220

auto_increment_increment=10

auto_increment_offset=5




Now start MYSQL installation

-Goto mysql binaries location

-Run Command: scripts/mysql_install_db --user=mysql --datadir=/var/lib/mysql



Start the MYSQL with below command

bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql &


Create ROOT user in MYSQL with below cmd and Update the PATH variable to contain "MySQL" software path

bin/mysqladmin -u root password 'google@123'


Connect MYSQL with ROOT user


Create service for MYSQL for start and stop

-copy mysql.server to /etc/init.d/


Rename /etc/init.d/mysql.server” to “/etc/init.d/mysql

and edit “/etc/init.d/mysql” with below fields

basedir=/usr/mysql/5.6.26/mysql-advanced-5.6.26-linux-glibc2.5-x86_64/

datadir=/var/lib/mysql



Check status


Set MYSQL binary path environmental variable


 Restart MYSQL instance with below command



Awesome!!! 


MYSQL instance installed sucesssful with TARBALL. Now you have 2 nodes of mysql


Node 1: MYSQL 5.6.24 installed using RPM

Node 2: MYSQL 5.6.24 installed using TARBALL

2 comments:

  1. Good Explanation, We have yet to go a long way off. Excellent Article.

    Thanks
    Deepak

    ReplyDelete