Lamp source installation of binary MySQL5.6.25 installation

Source: Internet
Author: User
Tags mysql commands


    1. Download the extracted source code, by the binary files, so need to extract into the/usr/local/directory

      Remove your own MySQL first

      [[email protected] lib]# rpm-qa|grep MySQL




      [[email protected] ~]# Yum remove MySQL

      Because the source code compilation time is too long, so here is the official website to obtain the binary installation package

      [Email protected] ~]# wget

      [Email protected] ~]# tar XF mysql-5.6.25-linux-glibc2.5-x86_64.tar.gz-c/usr/local/

      [Email protected] ~]# cd/usr/local

      [[email protected] local]# ln-sv mysql-5.6.25-linux-glibc2.5-x86_64 MySQL

2 installation process reference/extract directory/install_binary

[[Email protected] local]# CD MySQL

[Email protected] mysql]# more install-binary

Summarized as follows:

    1. Install Libaio (CentOS is installed by default) omitted here
    2. Adding MySQL Users and groups gives the reference command

      shell> Groupadd MySQL

      Shell> useradd-r-G MySQL MySQL


[[email protected] htdocs]# Groupadd MySQL

[[email protected] htdocs]# useradd-r-g MySQL MySQL

3 temporarily modify the installation directory file belongs to the main group of MySQL and execute the installation script/installation directory/scripts/mysql_install_db

[Email protected] ~]# Cd/usr/local/mysql

[Email protected] mysql]# chown-r Mysql.mysql *

About the Execute script note plus options, you can view it,--user=mysql--datadir=xx DataDir recommends using a separate partition

Add an LVM volume below

    1. Partition a 20G free space format for LVM (8e)

      Because my centos has no space, so add a hard disk in the virtual machine, specifically shutdown, then set, add below the left, select the hard drive.

      [Email protected] mysql]# Fdisk/dev/sdb

      Device Boot Start End Blocks Id System

      /DEV/SDB1 1 1306 10490413+ 8e Linux LVM

      Last input W, intermediate conversion type using T

Then create the PV

[Email protected] ~]# PVCREATE/DEV/SDB1

Physical volume "/DEV/SDB1" successfully created

The physical part is done, create the VG, remember to specify the name

[Email protected] ~]# vgcreate VGDATA/DEV/SDB1

Volume Group "Vgdata" successfully created

Create LV

[Email protected] ~]# lvcreate-l +10g-n lvdata vgdata

Logical volume "Lvdata" created

Formatting Lvdata

[Email protected] ~]# mke2fs-t ext4/dev/vgdata/lvdata

[Email protected] ~]# mkdir/data/

[Email protected] ~]# MOUNT/DEV/VG

Vga_arbiter vgdata/vg_livecd/

[Email protected] ~]# mount/dev/vgdata/lvdata/data/

[Email protected] ~]# df-th

Filesystem Type Size used Avail use% mounted on


Ext4 19G 4.4G 14G 25%/

Tmpfs tmpfs 238M 0 238M 0%/dev/shm

/DEV/SDA1 ext4 485M 34M 426M 8%/boot


Ext4 9.9G 151M 9.2G 2%/data

Boot mount

[[email protected] ~]# echo "/dev/vgdata/lvdata/data ext4 defaults 0 0" >>/etc/fstab

b) Execute the installation script

[Email protected] mysql]# mkdir/data/mysql/

[Email protected] mysql]#/scripts/mysql_install_db--user=mysql--datadir=/data/mysql

4 Installation Complete to change the owner to root, the data to the MySQL user, because we are on the new disk so do not change

[Email protected] mysql]# chown-r root *

5 Support-files/mysql.server can be copied into the startup script

[email protected] mysql]# CP support-files/mysql.server/etc/init.d/mysqld

Modify a file

[Email protected] mysql]# Vim/etc/init.d/mysql.server



6 my.cnf in the replication installation directory is/ETC/MY.CNF

Main changes Mydatadir, user

[Email protected] ~]# CP/USR/LOCAL/MYSQL/MY.CNF/ETC/MY.CNF

In the main configuration file found sock, etc., in fact, you need to define

7 Extra Action

    • Include Library (

[Email protected] mysql]# echo "/usr/local/mysql/lib" >>/etc/

    • Join the man Help information

      [[email protected] mysql]# man MySQL

      No Manual entry for MySQL

      So you need to join the man document to add a line to the/etc/man.config Manpath/usr/local/mysql/man

      We can use man.

    • Add path inclusion to use common commands

      [[email protected] mysql]# MySQL--help

      -bash:mysql:command not found

[Email protected] mysql]# echo "Export path= $PATH:/usr/local/mysql/bin" >>/etc/profile.d/

[Email protected] mysql]# source/etc/profile.d/

MySQL commands are ready for use.

    • Header file contains the issue

      In general, create the appropriate directory connection for it in/usr/include

      [Email protected] ~]# Ln-sv/usr/local/mysql/include/usr/include/mysql

      '/usr/include/mysql ', '/usr/local/mysql/include '

3 start our service and try it.

[[email protected] ~]# netstat-tlnp|grep MySQL

[Email protected] ~]#

[[Email protected] ~]# service mysqld start

Starting MySQL ... [OK]

[[email protected] ~]# netstat-tlnp|grep MySQL

TCP 0 0::: 3306:::* LISTEN 2790/mysqld

[[email protected] ~]# MySQL

Welcome to the MySQL Monitor. Commands End With; or \g.

Your MySQL Connection ID is 1

Server version:5.6.25 MySQL Community Server (GPL)

Copyright (c), Oracle and/or its affiliates. All rights reserved.



| Database |


| Information_schema |

| MySQL |

| Performance_schema |

| Test |


4 rows in Set (0.02 sec)


4 below still think the premise Apache httpd installs, inside has socket, have pidfile file

So here continue to try, because the main configuration file has sock settings, so please create the appropriate folder yourself, and restart the service in that folder will have the corresponding sock file.

is always can't find the Pidfile file, in fact, I ignored the first to create the Data folder/data/mysql, if you want to know this is very simple

A good command on the Web

[Email protected] mysqld]# PS Ax|grep mysqld

4172 pts/0 S 0:00/bin/sh/usr/local/mysql/bin/mysqld_safe--datadir=/data/mysql--pid-file=/data/mysql/

4390 pts/0 Sl 0:00/usr/local/mysql/bin/mysqld--basedir=/usr/local/mysql--datadir=/data/mysql--plugin-dir=/usr/ Local/mysql/lib/plugin--user=mysql--log-error=/data/mysql/localhost.localdomain.err--pid-file=/data/mysql/

4420 pts/0 s+ 0:00 grep mysqld

Lamp source installation of binary MySQL5.6.25 installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.