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/
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/
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
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
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
No comments:
Post a Comment