MySQL5.6 binary Package compilation and installation details (iii)

Source: Internet
Author: User

First, the SOFTWARE environment
Ii. detailed installation and deployment process
    1. MySQL Installation 3 ways:
      1>RPM Package Installation
      Application files are installed by default in the/usr/local directory
      2> Source Code Compilation
      Need to customize file paths and parameters
      3> Binary-Free compilation method
      The advantage is that you can specify the file installation path, there is no dependency package problem
    2. Download the installation package to/USR/LOCAL/SRC
      [[email protected] ~]# cd /usr/local/src/[[email protected] src]# wget http://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz

    3. Unzip the TAR installation package
      [[email protected] src]# tar -zxvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz

      See if there is an error in the decompression process

      [[email protected] src]# echo $?0

      Description: Return 0 means the decompression was successful, or the decompression failed

    4. To move the rename, note that when you execute this command, the/usr/local/below is the one with no MySQL directory
[[email protected] src]# mv  mysql-5.6.39-linux-glibc2.12-x86_64 /usr/local/mysql[[email protected] src]# lltotal 321176-rw-r--r-- 1 root root 328882304 Dec  9  2017 mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz[[email protected] src]# ll /usr/local/mysql/


5. Create MySQL users and user groups

[[email protected] src]# cd /usr/local/mysql/[[email protected] mysql]# useradd mysql

6. Create a database directory/data/mysql

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

7. Initializing the database

[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/date/mysqlFATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:Data::Dumper

Error Analysis:
Initializing the MySQL database to report this error is due to the lack of data::D Umper This module

Workaround 1: Install the AOTUCONF library

yum -y install autoconf  

Workaround 2: Fuzzy search for both Perl and dumper packages

[[email protected] mysql]# yum list | grep perl |grep -i dumper


There are 4 dumper related packages, if you do not know which package is missing, we recommend that yum install each package in turn, and then execute the database initialization command to see the results returned

To execute the database initialization command, you can determine the success of the database initialization from two aspects
A. Execution of the database initialization process occurs with two OK

B. Execute echo $? Whether the return value is 0

说明:echo $?的作用是检查上一条命令执行状态,成功返回0,失败返回非0

8. Copy the profile template for mysql5.6

[[email protected] mysql]# cp ./support-files/my-default.cnf /etc/my.cnf
编辑/etc/my.cnfdatadir = /data/mysqlsocket = /tmp/mysql.sock

9. Move the startup script of the mysql5.6 database to/etc/init.d/mysqld

编辑数据库启动脚本/etc/init.d/mysqld,修改basedir=datadir=参数为basedir=/usr/local/mysqldatadir=/data/mysql

On centos7.5, if you want to add the MySQL database startup script to the system boot, execute the following command

10. Start the MySQL database and execute

[[email protected] mysql]# service mysqld startStarting MySQL.Logging to ‘/data/mysql/localhost.localdomain.err‘.................. SUCCESS!或者[[email protected] mysql]# /etc/init.d/mysqld restartShutting down MySQL.. SUCCESS!Starting MySQL. SUCCESS![[email protected] mysql]#此时可查看到mysql数据库进程[[email protected] mysql]# ps -ef |grep mysqld

查看数据库监控的端口为3306[[email protected] mysql]# netstat -nlpt


11. Start the MySQL service from the command line

[[email protected] mysql]# /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/localhost.localdomain.pid &[[email protected] ~]# ps -ef |grep mysqldroot      20630  17325  0 02:09 pts/0    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/localhost.localdomain.pidmysql     20767  20630  0 02:09 pts/0    00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=localhost.localdomain.err --pid-file=/data/mysql/localhost.localdomain.pid --socket=/tmp/mysql.sockroot      20861  20802  0 02:10 pts/1    00:00:00 grep --color=auto mysqld

MySQL5.6 binary Package compilation and installation details (iii)

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: info-contact@alibabacloud.com 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.