Thursday, February 20, 2014

MySQL Standard Generic Binary Installation from a compressed tar file binary distribution

      MySQL Standard Generic Binary Installation from a compressed tar file binary distribution

                                                  Created By : Amit Gera DBA(MySQL & ORACLE)
Goal: MySQL Standard Generic Binary Installation from a compressed tar file binary distribution
OS:- Centos 6.3 64 Bit
Partition Requirement:-
/mysql_admin:-Will contains mysql binaries and confirguration file
/mysql_backup:-Will contains mysql backup [i.e dumpfile or export files or import files]
/mysql_data:- Will contains data files
/mysql_home:-Will contains profiles , sql scripts etc
/mysql_logs:- Will contains log files [i.e trace ,alert , binary , slow query & general audit logfiles]

Note:-Here I have use name amit wrt service name ,As per guidelines we must set it to meaningful name i.e product service name


Prerequisites:-http://myora-dba-notes.blogspot.in/2014/03/mysql-distribution-formats.html

#~~#Step 1:-Download mysql packages for ubuntu
a.Create downloading destination directory
cmd:-mkdir -p /mysql_admin/mysql_binaries/download
b.Start Downloading at destination directory
If internet is available then use this cmd:-
wget -O /mysql_admin/mysql_binaries/download/mysqlbinaries-5.6.16.tar.gz http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.16-linux-glibc2.5-x86_64.tar.gz

Else download this from other sources and copy here

Note:-Post downloadation step we recommend to verify the integrity of the packages downloaded.
Cmd:- md5sum -t /mysql_admin/mysql_binaries/download/mysqlbinaries-5.6.16.tar.gz
Compare the output of trail cmd with the checksum shown on download url page

#~~#Step 2:-
a.Create group and create user in that group for mysql
cmds:-
groupadd mysql_grp
useradd -r -g mysql_grp mysql_user
b.Create directory mention in below configuration file of step 6
cmds:-
mkdir -p /mysql_data/ibtablespace/
mkdir -p /mysql_data/datadir/
mkdir -p /mysql_data/iblogs
mkdir -p /mysql_logs/slow_logs/
mkdir -p /mysql_logs/error_log
mkdir -p /mysql_logs/replication_log
mkdir -p /mysql_logs/mytmp/
chown mysql_user.mysql_grp -R /mysql_data/
chown mysql_user.mysql_grp -R /mysql_logs/
c.Create configuration & binary directories
cmds:-
mkdir -p /mysql_admin/configuration_file
touch /mysql_admin/configuration_file/my.cnf
mkdir /mysql_admin/mysql_binaries/

#~~#Step 3:-Add following below listed entries into environment file and load it in envrinoment
step a. cmd:-
echo "myadmin="/mysql_admin/"" >> /etc/environment
echo "basedir="/mysql_admin/mysql_binaries/"" >> /etc/environment
echo "myconf="/mysql_admin/configuration_file"" >> /etc/environment
echo "MYSQL_HOME="/mysql_home/homedir"" >> /etc/environment
echo "myadmin_download="/mysql_admin/mysql_binaries/download"" >> /etc/environment
step b. Run the file with cmd:-source /etc/environment

#~~#Step 4:- Extract binaries 
cmd:-cd $basedir
cmd:- tar zxvf $myadmin_download/mysqlbinaries-5.6.16.tar.gz -C /mysql_admin/mysql_binaries/
cmd:- ln -s /mysql_admin/mysql_binaries/mysql-5.6.16-linux-glibc2.5-x86_64 binaries

#~~#Step 5:-Add following below listed entries into environment file and load it in envrinoment
step a. cmd:-
echo "PATH="$PATH:/mysql_admin/mysql_binaries/binaries/bin"" >> /etc/environment
step b. Run the file with cmd:-source /etc/environment

#~~#Step 6: Create configuration file
a. vi /mysql_admin/configuration_file/my.cnf
b. write below listed information into configuration file and save
[client]
port = 3310
socket = /mysql_data/my_amit.sock
# The MySQL server
[mysqld]
user=mysql_user
port = 3310
socket = /mysql_data/my_amit.sock
basedir=/mysql_admin/mysql_binaries/binaries
pid-file =/mysql_data/my_amit.pid
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
tmpdir=/mysql_logs/mytmp/
datadir=/mysql_data/datadir/
innodb_data_home_dir = /mysql_data/ibtablespace/
innodb_mirrored_log_groups=1
innodb_log_group_home_dir = /mysql_data/iblogs
innodb_log_files_in_group=3
innodb_log_file_size=256M
log-bin = /mysql_logs/replication_log/amit-replication
log-error = /mysql_logs/error_log/amit-mysqllog.err
slow_query_log=on
long_query_time=1
slow_query_log_file=/mysql_logs/slow_logs/amit-master-slow.log
default-storage-engine = innodb
innodb_file_per_table

#~~#Step 7:- Now we have to initializes the MySQL data directory and creates the system tables that it should contains.
cmd:-cd $basedir/mysql-5.6.16-linux-glibc2.5-x86_64/
cmd:-scripts/mysql_install_db --user=mysql_user --basedir=/mysql_admin/mysql_binaries/binaries --defaults-file=/mysql_admin/configuration_file/my.cnf

Note: option user=mysql_user is used in order to initialized db with ownership mysql user

There are some third party tool which can help you in creation or tunning of configuration files with respect to inputs mentiones
URL for Percona Configuration Wizard for MySQL is :-https://tools.percona.com/ or https://tools.percona.com/wizard

#~~#Step8: There are many ways by which we can start mysql and here we invoke mysql.server script method that use System V-style run directories (that is, /etc/init.d and run-level specific directories),
##Generally, you start the mysqld server in one of these ways:
a.Invoke mysqld directly. This works on any platform.
b.Invoke mysqld_safe, which tries to determine the proper options for mysqld and then runs it with those options. This script is used on Unix and Unix-like systems.
c.Invoke mysql.server. This script is used primarily at system startup and shutdown on systems that use System V-style run directories (that is, /etc/init.d and run-level specific directories), where it usually is installed under the name mysql. The mysql.server script starts the server by invoking mysqld_safe.
d.On Mac OS X, install a separate MySQL Startup Item package to enable the automatic startup of MySQL on system startup. The Startup Item starts the server by invoking mysql.server.
e.Use the Solaris/OpenSolaris service management framework (SMF) system to initiate and control MySQL startup.

After initializing db ,Now we are proceding to add service in System V-style run directories

Execution steps:-
a.Copy server script and add in system V-style run directories
cmd:-cp /mysql_admin/mysql_binaries/binaries/support-files/mysql.server /etc/init.d/mysql_amit_service
b. add in chmod +x /etc/init.d/mysql_amit_service

b.Optional if there is any old services which we need to remove :-
cmd:-chkconfig --list | grep old_mysql_servicename
if present then remove with below command
cmd:- chkconfig –del old_mysql_servicename
c. Adding system startup for /etc/init.d/mysql_amit_service ...
cmd:- chkconfig --add mysql_amit_service or chkconfig mysql_amit_service on

#~~#Step 9:
Before making link please make sure no my.cnf file exist in /etc directory
If exist then delete that file cmd:- rm -rf /etc/my.cnf and proceed further
cmd:-ln -s /mysql_admin/configuration_file/my.cnf /etc/my.cnf

#~~#Step 10: Now you can start mysql with
/etc/init.d/mysql_amit_service start
or
/etc/init.d/mysql_amit_service start

Note: We can Shutdown with
/etc/init.d/mysql_amit_service stop
or
/etc/init.d/mysql_amit_service stop


Friday, February 14, 2014

MySQL Binary Installation on Ubuntu

                                    MySQL Binary Installation on Ubuntu

                 Created By : Amit Gera DBA(MySQL & ORACLE)
Goal:MySQL Standard Binary Installation on Ubuntu 64 bit through package

Partition Requirement:-
/mysql_admin:-Will contains mysql binaries and confirguration file
/mysql_backup:-Will contains mysql backup [i.e dumpfile or export files or import files]
/mysql_data:- Will contains data files
/mysql_home:-Will contains profiles , sql scripts etc
/mysql_logs:- Will contains log files [i.e trace ,alert , binary , slow query & general audit logfiles]



Note:-Here I have use name amit wrt service name ,As per guidelines we must set it to meaningful name i.e product service name

Prerequisites:-http://myora-dba-notes.blogspot.in/2014/03/mysql-distribution-formats.html

#~~#Step 1:-Download mysql packages for ubuntu
a.Create downloading destination directory
cmd:-mkdir -p /mysql_admin/mysql_binaries/download
b.Start Downloading at destination directory
If internet is available then use this cmd:-
wget -O /mysql_admin/mysql_binaries/download/mysql-5.6.16.deb http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.16-debian6.0-x86_64.deb
Else download this from other sources and copy here

#~~#Step 2:-
a.Create group and create user in that group for mysql
cmd:-
groupadd mysql_grp
useradd -r -g mysql_grp mysql_user
b.Create directory mention in below configuration file of step 5
cmd:-
mkdir -p /mysql_data/ibtablespace/
mkdir -p /mysql_data/datadir/
mkdir -p /mysql_data/iblogs
mkdir -p /mysql_logs/slow_logs/
mkdir -p /mysql_logs/error_log
mkdir -p /mysql_logs/replication_log
mkdir -p /mysql_logs/mytmp/
chown mysql_user.mysql_grp -R /mysql_data/
chown mysql_user.mysql_grp -R /mysql_logs/
c.Create configuration & binary directories
mkdir -p /mysql_admin/configuration_file
touch /mysql_admin/configuration_file/my.cnf
mkdir /mysql_admin/mysql_binaries/mysqlbinaries-5.6.16

#~~#Step 3:-Add following below listed entries into environment file and load it in envrinoment
step a. cmd:-
echo "PATH="$PATH:/mysql_admin/mysql_binaries/mysqlbinaries-5.6.16/opt/mysql/server-5.6/bin"" >> /etc/environment
echo "myadmin="/mysql_admin/"" >> /etc/environment
echo "basedir="/mysql_admin/mysql_binaries/mysqlbinaries-5.6.16"" >> /etc/environment
echo "myconf="/mysql_admin/configuration_file"" >> /etc/environment
echo "MYSQL_HOME="/mysql_home/homedir"" >> /etc/environment
echo "myadmin_download="/mysql_admin/mysql_binaries/download"" >> /etc/environment
step b. Run the file with cmd:-source /etc/environment

#~~#Step 4:- Install the package with command dpkg -i package-file-name
cmd:- dpkg -i --instdir=$basedir $myadmin_download/mysql-5.6.16.deb

#~~#Step 5:-
a.Check package is installed or not by command dpkg -l | grep 'keywork to be matched'
cmd:- dpkg -l | grep 'libaio1' or dpkg -l \*libaio1\*
Note:- Package information is stored in File Name /var/lib/dpkg/status
b.Install package if not present
cmd:-apt-get install libaio1

#~~#Step 6: Create configuration file
a. vi /mysql_admin/configuration_file/my.cnf
b. write below listed information into configuration file and save
[client]
port = 3310
socket = /mysql_data/my_amit.sock
# The MySQL server
[mysqld]
user=mysql_user
port = 3310
socket = /mysql_data/my_amit.sock
basedir=/mysql_admin/mysql_binaries/mysqlbinaries-5.6.16/opt/mysql/server-5.6
pid-file =/mysql_data/my_amit.pid
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
tmpdir=/mysql_logs/mytmp/
datadir=/mysql_data/datadir/
innodb_data_home_dir = /mysql_data/ibtablespace/
innodb_mirrored_log_groups=1
innodb_log_group_home_dir = /mysql_data/iblogs
innodb_log_files_in_group=3
innodb_log_file_size=256M
log-bin = /mysql_logs/replication_log/amit-replication
log-error = /mysql_logs/error_log/amit-mysqllog.err
slow_query_log=on
long_query_time=1
slow_query_log_file=/mysql_logs/slow_logs/amit-master-slow.log
default-storage-engine = innodb
innodb_file_per_table

#~~#Step 7:- Now we have to initializes the MySQL data directory and creates the system tables that it should contains.
cmd:-
cd $basedir/opt/mysql/server-5.6/
scripts/mysql_install_db --user=mysql_user --basedir=/mysql_admin/mysql_binaries/mysqlbinaries-5.6.16/opt/mysql/server-5.6 --defaults-file=/mysql_admin/configuration_file/my.cnf

Note: option user=mysql_user is used in order to initialized db with ownership mysql user

There are some third party tool which can help you in creation or tunning of configuration files with respect to inputs mentiones
URL for Percona Configuration Wizard for MySQL is :-https://tools.percona.com/ or https://tools.percona.com/wizard


#~~#Step8: There are many ways by which we can start mysql and here we invoke mysql.server script method that use System V-style run directories (that is, /etc/init.d and run-level specific directories),
##Generally, you start the mysqld server in one of these ways:
a.Invoke mysqld directly. This works on any platform.
b.Invoke mysqld_safe, which tries to determine the proper options for mysqld and then runs it with those options. This script is used on Unix and Unix-like systems.
c.Invoke mysql.server. This script is used primarily at system startup and shutdown on systems that use System V-style run directories (that is, /etc/init.d and run-level specific directories), where it usually is installed under the name mysql. The mysql.server script starts the server by invoking mysqld_safe.
d.On Mac OS X, install a separate MySQL Startup Item package to enable the automatic startup of MySQL on system startup. The Startup Item starts the server by invoking mysql.server.
e.Use the Solaris/OpenSolaris service management framework (SMF) system to initiate and control MySQL startup.

After initializing db ,Now we are proceding to add service in System V-style run directories

Execution steps:-
a.Copy server script and add in system V-style run directories
cmd:-
cp /mysql_admin/mysql_binaries/mysqlbinaries-5.6.16/opt/mysql/server-5.6/support-files/mysql.server /etc/init.d/mysql_amit_service
b.Optional if there is any old services which we need to remove :-
cmd:-update-rc.d -f old_mysql_service_name remove
c. Adding system startup for /etc/init.d/mysql_amit_service ...
cmd:-update-rc.d mysql_amit_service defaults

#~~#Step 9:- update socket in mysql_config
cmd:-
mysql_config_editor set --socket=/mysql_data/my_amit.sock

#~~#Step 10:
ln -s /mysql_admin/configuration_file/my.cnf /etc/my.cnf

#~~#Step 11: Now you can start mysql with
/etc/init.d/mysql_amit_service start
or
/etc/init.d/mysql_amit_service start

Note: We can Shutdown with
/etc/init.d/mysql_amit_service stop
or
/etc/init.d/mysql_amit_service stop



MySQL Standard Source Installation on Ubuntu

                             MySQL Standard Source Installation on Ubuntu

              Created By : Amit Gera DBA(MySQL & ORACLE)

Goal:MySQL Standard based source installation on Ubuntu 64 bit 

Partition Requirement:-
/mysql_admin:-Will contains mysql binaries and confirguration file
/mysql_backup:-Will contains mysql backup [i.e dumpfile or export files or import files]
/mysql_data :- Will contains data files
/mysql_home:-Will contains profiles , sql scripts etc
/mysql_logs:- Will contains log files [i.e trace ,alert , binary , slow query & general audit logfiles]


Note:-Here I have use name amit wrt service name ,As per guidelines we must set it to meaningful name i.e product service name

Prerequisites:-http://myora-dba-notes.blogspot.in/2014/03/mysql-distribution-formats.html

Step 1:-
a.Create group and create user in that group for mysql
cmd:-
groupadd mysql_grp
useradd -r -g mysql_grp mysql_user
b.Create directory mention in below configuration file of step 5
cmd:-
mkdir -p /mysql_data/ibtablespace/
mkdir -p /mysql_data/datadir/
mkdir -p /mysql_data/iblogs
mkdir -p /mysql_logs/slow_logs/
mkdir -p /mysql_logs/error_log
mkdir -p /mysql_logs/replication_log
mkdir -p /mysql_logs/mytmp/
chown mysql_user.mysql_grp -R /mysql_data/
chown mysql_user.mysql_grp -R /mysql_logs/


c.Create configuration & binary directories
mkdir -p /mysql_admin/configuration_file
touch /mysql_admin/configuration_file/my.cnf
mkdir -p /mysql_admin/mysql_binaries


#~~#Step 2:- Add following below listed entries into environment file and load it in envrinoment
step a. cmd:-
echo "PATH="$PATH:/mysql_admin/mysql_binaries/mysqlbinaries-5.6.16/bin"" >> /etc/environment
echo "myadmin="/mysql_admin/"" >> /etc/environment
echo "basedir="/mysql_admin/mysql_binaries/mysqlbinaries-5.6.16"" >> /etc/environment
echo "myconf="/mysql_admin/configuration_file"" >> /etc/environment
echo "MYSQL_HOME="/mysql_home/homedir"" >> /etc/environment
step b. Run the file with cmd:-source /etc/environment

#~~#Step 3:- Install the package with command apt-get install package-name
Before installation please do step 4 i.e for first checking the package status .If pkg are not installed then proceed step 3 else 5
If internet is available then use this cmd:- apt-get install -y cmake build-essential libreadline6-dev libncurses5-dev
Else downloaded the package from other sources and copy to this and Install the package on this with command dpkg -i package-file-name

#~~#Step 4:- Check package is installed or not by command dpkg -l | grep 'keywork to be matched'
a.cmd:- dpkg -l \*libncurses\*
b.cmd:- dpkg -l cmake
Note:- Package information is stored in File Name /var/lib/dpkg/status

#~~#Step 5:-Download mysql source build(option - https://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html) and Compile & Build MySQL using Cmake
a. Download source
cmds:-
mkdir -p /mysql_admin/mysql_binaries/download
cd /mysql_admin/mysql_binaries/download
b.Extract binaries
cd /mysql_admin/mysql_binaries/download
tar xvfz mysql-5.6.16.tar.gz
c.Check is CmakeCache.txt file exsist or not , if present then delete that file else proceed with step d
cd mysql-5.6.16
rm CmakeCache.txt
d.Complie & Build Mysql
Please read below notes before proceeding so as to be aware of what plugins or engines we need to build:-
The MyISAM, MERGE, MEMORY, and CSV engines are mandatory (always compiled into the server) and need not be installed explicitly.

To compile a storage engine statically into the server, use -DWITH_engine_STORAGE_ENGINE=1. Some permissible engine values are ARCHIVE, BLACKHOLE, EXAMPLE, FEDERATED, INNOBASE (InnoDB), NDB or NDBCLUSTER (NDB), PARTITION (partitioning support), and PERFSCHEMA (Performance Schema). Examples:
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1

WITH_NDBCLUSTER_STORAGE_ENGINE is supported only when building MySQL Cluster using the MySQL Cluster sources. It cannot be used to enable clustering support in other MySQL source trees or distributions. In MySQL Cluster NDB 7.3 source distributions, it is enabled by default. See Section 17.2.2.3, “Building MySQL Cluster from Source on Linux”, and Section 17.2.3.2, “Compiling and Installing MySQL Cluster from Source on Windows”, for more information.

To exclude a storage engine from the build, use -DWITHOUT_engine_STORAGE_ENGINE=1. Examples:
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
-DWITHOUT_PARTITION_STORAGE_ENGINE=1

If neither -DWITH_engine_STORAGE_ENGINE nor -DWITHOUT_engine_STORAGE_ENGINE are specified for a given storage engine, the engine is built as a shared module, or excluded if it cannot be built as a shared module.

Cmd1:- Either follow i) or ii) in this step

Note:Please be aware of this before proceeding this step
-DDEFAULT_CHARSET=charset_name
The server character set. By default, MySQL uses the latin1 (cp1252 West European) character set.
charset_name may be one of binary, armscii8, ascii, big5, cp1250, cp1251, cp1256, cp1257, cp850, cp852, cp866, cp932, dec8, eucjpms, euckr, gb2312, gbk, geostd8, greek, hebrew, hp8, keybcs2, koi8r, koi8u, latin1, latin2, latin5, latin7, macce, macroman, sjis, swe7, tis620, ucs2, ujis, utf8, utf8mb4, utf16, utf16le, utf32. The permissible character sets are listed in the cmake/character_sets.cmake file as the value of CHARSETS_AVAILABLE.
This value can be set at server startup with the --character_set_server option.
-DDEFAULT_COLLATION=collation_name
The server collation. By default, MySQL uses latin1_swedish_ci. Use the SHOW COLLATION statement to determine which collations are available for each character set.
This value can be set at server startup with the --collation_server option.

i). For Compiling with latin which is default use below cmd :-
Note:If we follow this step I.e utf8 character set & collation then In Step 6,we do not need to perform step 6.e
cmake \
-DCMAKE_INSTALL_PREFIX=/mysql_admin/mysql_binaries/mysqlbinaries-5.6.16 \
-DWITH_INNOBASE_STORAGE_ENGINE=1\
-DMYSQL_UNIX_ADDR=/mysql_data/my_amit.sock \
-DSYSCONFDIR=/mysql_admin/configuration_file \
.

or

cmake \
-DCMAKE_INSTALL_PREFIX=/mysql_admin/mysql_binaries/mysqlbinaries-5.6.16 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DMYSQL_UNIX_ADDR=/mysql_data/my_amit.sock \
-DSYSCONFDIR=/mysql_admin/configuration_file \
.

or

ii).For Compiling with utf8 use below cmd parameters setting in above cmd :-
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
Note:If we follow this step I.e utf8 character set & collation then In Step 6,we have to perform step 6.c

Cmd2:-make
Cmd3:-make install


d.Note:- This step is required If CMake fails, you might need to reconfigure by running it again with different options. If you do reconfigure, take note of the following:
If CMake is run after it has previously been run, it may use information that was gathered during its previous invocation. This information is stored in CMakeCache.txt. When CMake starts up, it looks for that file and reads its contents if it exists, on the assumption that the information is still correct. That assumption is invalid when you reconfigure.
Each time you run CMake, you must run make again to recompile. However, you may want to remove old object files from previous builds first because they were compiled using different configuration options.
To prevent old object files or configuration information from being used, run these commands on OS before re-running CMake:
cmds:-cd mysql-5.6.16
make clean

rm CmakeCache.txt

#~~#Step 6: Create configuration file
a. vi /mysql_admin/configuration_file/my.cnf
b. write below listed information into configuration file and save
[client]
port = 3310
socket = /mysql_data/my_amit.sock
# The MySQL server
[mysqld]
user=mysql_user
port = 3310
socket = /mysql_data/my_amit.sock
basedir=/mysql_admin/mysql_binaries/mysqlbinaries-5.6.16
pid-file =/mysql_data/my_amit.pid
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
tmpdir=/mysql_logs/mytmp/
datadir=/mysql_data/datadir/
innodb_data_home_dir = /mysql_data/ibtablespace/
innodb_mirrored_log_groups=1
innodb_log_group_home_dir = /mysql_data/iblogs
innodb_log_files_in_group=3
innodb_log_file_size=256M
log-bin = /mysql_logs/replication_log/amit-replication
log-error = /mysql_logs/error_log/amit-mysqllog.err
slow_query_log=on
long_query_time=1
slow_query_log_file=/mysql_logs/slow_logs/amit-master-slow.log
default-storage-engine = innodb
innodb_file_per_table

c. Note:- This step is only for if source installation in step 5 is build with -DDEFAULT_CHARSET=utf8 &
-DDEFAULT_COLLATION=utf8_general_ci
Add following lines in configuration files
cmd:-
echo "character-set-server = utf8" >> /mysql_admin/configuration_file/my.cnf
echo "collation-server = utf8_general_ci" >> /mysql_admin/configuration_file/my.cnf
echo "character-set-client-handshake = false" >> /mysql_admin/configuration_file/my.cnf

#~~#Step 7:- Now we have to initializes the MySQL data directory and creates the system tables that it should contains.
cmd:-
/mysql_admin/mysql_binaries/mysqlbinaries-5.6.16/scripts/mysql_install_db --user=mysql_user --basedir=/mysql_admin/mysql_binaries/mysqlbinaries-5.6.16 --defaults-file=/mysql_admin/configuration_file/my.cnf

Note: option user=mysql_user is used in order to initialized db with ownership mysql user

There are some third party tool which can help us in creation of configuration files with respect to inputs we mentioned there.
URL for Percona Configuration Wizard for MySQL is :-https://tools.percona.com/ or https://tools.percona.com/wizard


#~~#Step8: There are many ways by which we can start mysql and here we invoke mysql.server script method that use System V-style run directories (that is, /etc/init.d and run-level specific directories),
##Generally, you start the mysqld server in one of these ways:
a.Invoke mysqld directly. This works on any platform.
b.Invoke mysqld_safe, which tries to determine the proper options for mysqld and then runs it with those options. This script is used on Unix and Unix-like systems.
c.Invoke mysql.server. This script is used primarily at system startup and shutdown on systems that use System V-style run directories (that is, /etc/init.d and run-level specific directories), where it usually is installed under the name mysql. The mysql.server script starts the server by invoking mysqld_safe.
d.On Mac OS X, install a separate MySQL Startup Item package to enable the automatic startup of MySQL on system startup. The Startup Item starts the server by invoking mysql.server.
e.Use the Solaris/OpenSolaris service management framework (SMF) system to initiate and control MySQL startup.

After initializing db ,Now we are proceding to add service in System V-style run directories

Execution steps:-
a.Copy server script and add in system V-style run directories
cmd:-
cp /mysql_admin/mysql_binaries/mysqlbinaries-5.6.16/support-files/mysql.server /etc/init.d/mysql_amit_service

b.Optional if there is any old services which we need to remove :-
Removing any system startup links for old mysql service if any /etc/init.d/mysql ...
cmd:-update-rc.d -f old_mysql_service_name remove

c. Adding system startup for /etc/init.d/mysql_amit_service ...
cmd:-update-rc.d mysql_amit_service defaults

#~~#Step 9: Now you can start mysql with
/etc/init.d/mysql_amit_service start
or
/etc/init.d/mysql_amit_service start

Note: We can Shutdown with
/etc/init.d/mysql_amit_service stop
or
/etc/init.d/mysql_amit_service stop