you're reading...
MySQL Installation & Configuration

MySQL database sourcecode Installation on CentOS Linux

MySQL database sourcecode Installation on CentOS(6.7) Linux

Step1) Extract the installation package

[root@LXTEST01 ~]# tar -xvzf make-4.1.tar.gz
[root@LXTEST01 ~]# tar -xvzf bison-3.0.4.tar.gz
[root@LXTEST01 ~]# tar -xvzf cmake-3.1.0.tar.gz
[root@LXTEST01 ~]# tar -xvzf mysql-5.5.39.tar.gz

Step2) Install Make

[root@LXTEST01 ~]# cd make-4.1
[root@LXTEST01 make-4.1]# ./configure
[root@LXTEST01 make-4.1]# make
[root@LXTEST01 make-4.1]# make install

Step3) Install bison

[root@LXTEST01 ~]# cd bison-3.0.4
[root@LXTEST01 bison-3.0.4]# ./configure
[root@LXTEST01 bison-3.0.4]# make
[root@LXTEST01 bison-3.0.4]# make install

Step4) Install cmake

[root@LXTEST01 ~]# cd cmake-3.1.0
[root@LXTEST01 cmake-3.1.0]# ./configure
[root@LXTEST01 cmake-3.1.0]# make
[root@LXTEST01 cmake-3.1.0]# make install

Step5) Add user and group for MYSQL

[root@LXTEST01 ~]# groupadd mysql  
[root@LXTEST01 ~]# useradd -g mysql -d /home/mysql -s /bin/bash -c "MySQL Software Owner" mysql  

Step6) Install MySQL

[root@LXTEST01 ~]# cd mysql-5.5.39
[root@LXTEST01 mysql-5.5.39]# 
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
[root@LXTEST01 mysql-5.5.39]# make && make install
[root@LXTESTWIKI01 mysql-5.5.39]# chown -R mysql:mysql /usr/local/mysql
[root@LXTESTWIKI01 mysql-5.5.39]# scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql

Modify the /etc/profile file,add the following contents at the end of the file

export PATH=/usr/local/mysql/bin:$PATH

Apply the /etc/profile to live

[root@LXTESTWIKI01 root]# source /etc/profile

Step7) Start mysql

Locate the my.cnf

[root@LXTEST01 mysql-5.5.39]# find / -name my.cnf

Modify the content of the /etc/my.cnf

# Disabling symbolic-links is recommended to prevent assorted security risks


Notice the folder location socket has been changed as socket=/tmp/mysql.sock

[root@LXTEST01 mysql-5.5.39]# bin/mysqld_safe --user=mysql & 
[root@LXTEST01 mysql-5.5.39]# cp support-files/mysql.server /etc/init.d/mysql 
[root@LXTEST01 mysql-5.5.39]# service mysql start  
[root@LXTEST01 mysql-5.5.39]# service mysql stop  
[root@LXTEST01 mysql-5.5.39]# service mysql restart
[root@LXTEST01 mysql-5.5.39]# chkconfig --add mysql

Step8) Reset the mysql root password

[root@LXTEST01 ~]# cd /usr/local/mysql
[root@LXTEST01 mysql-5.5.39]# ./bin/mysqladmin -u root password
[root@LXTEST01 mysql-5.5.39]# /usr/local/mysql/bin/mysqld_safe –defaults-file=/etc/my.cnf &
[root@LXTEST01 mysql-5.5.39]# /etc/init.d/mysql start (service mysql start)
[root@LXTEST01 mysql-5.5.39]# mysqladmin version 

Step9) Start and Shutdown MySQL in mysqld_safe

[root@LXTEST01 mysql-5.5.39]# bin/mysqld_safe --user=mysql &
[root@LXTESTWIKI01 mysql-5.5.39]# mysql --sock=/tmp/mysql.sock --port 3306 -u root -p
[root@LXTEST01 mysql-5.5.39]# bin/mysqladmin -uroot -p -h127.0.0.1 shutdown

About daviewning

I am an Oracle DBA



  1. Pingback: PHP 5.5 Installation (source code) on CentOS Linux | DBTechZone - March 16, 2016

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: