Mysql 5.6 Version Binary installation

Source: Internet
Author: User

Date: 2018.7.30
Li Qiang
Reference: man,info,magedu handouts, Universal Internet
Lab environment: VMware? Workstation Pro, Centos 6.9,centos 7.4,securecrt Version 8.1.4
Statement: The following English is purely personal translation, English Class B, welcome to correct, the following is purely personal understanding, and there is no right or wrong, just reference, piracy does not correct, can be limited, hope not fraught as well.
Version: v1-2018.7.30

Resources

1, https://www.cnblogs.com/BrightMoon/p/4730081.html
2, https://dev.mysql.com/doc/refman/5.6/en/installing.html

Official Download site:

https://dev.mysql.com/downloads/mysql/

can download RPM package, repo warehouse. Binary packages, etc.

Some mirror sites such as Sohu, Ali, NetEase and so on are not good.

MySQL installation Why most of the binary installation is used. Rather than manually compiling the source code?

MySQL is used by glibc for development. GLIBC Library is a low-level API, so as long as Linux, there will be glibc library. Therefore, MySQL installation does not need to consider whether the environment meets the requirements. Portability is convenient. It is also possible to copy the compiled binary code directly onto another machine.

The original rational thing: generally install a software under Linux, different software needs a different library of functions. You will encounter a phenomenon where a software copy to another platform may not work. Installing the software requires the environment to be detected first. Because MySQL is using a common glibc library of functions. There is no dependency on other things. Therefore, copying from one platform to another can be common. There is no need to detect the environment. Directly using the compiled binary

Manually compiling the installation, appears to be a step troublesome. Based on the features of MySQL, the binary installation is entirely possible.

Note: The CMake command is required for mysql5.5 installation, so it is necessary to ensure that the command is installed on your machine. If not, you have to install the cmake. Also seems troublesome. I don't want to install the latest version for the time being.

What if I use a binary installation upgrade?

The upgrade Gets or is a binary compression package. Then, simply switch to the directory to the new directory.

There is no need to involve manual compilation, like PHP, to achieve the benefits of your own custom modules. While MySQL installation does not need to involve the module

MySQL official recommended installation method: Binary installation.

The following is the installation of the binary version 5.6.41 operation steps

First, pre-installation environment preparation:

1, rely on the library check

The main is to see if the binary installation depends on the existence of the library, database initialization and service startup requires this library

shell> yum search libaio  # search for infoshell> yum install libaio # install library

2. Installation related planning

    软件安装目录      /usr/loca/app/mysql_13306    数据库存放目录  /data/mysql_13306    port                     13306    pid_file                /data/mysql_13306/mysql_13306.pid    socket                 /data/mysql_13306/mysql_13306.socket    log_error             /var/log/mysql_13306.log
Second, the installation step of the system

1. Create user

shell> groupadd mysqlshell> useradd -r -g mysql -s /bin/false mysql

2. Download Binary Package

shell> cd /usr/local/appshell> wget https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.41-linux-glibc2.12-x86_64.tar.gzshell> tar zxvf mysql-5.6.41-linux-glibc2.12-x86_64.tar.gzshell> mv mysql-5.6.41-linux-glibc2.12-x86_64 mysql_13306shell> ln -s  mysql_13306  ../mysql_13306# 我觉得建立软链接其实作用就是因为默认的路径就是这里。当我们安装多实例的时候,这个步骤就没有意义了。shell>cd /usr/local/app/mysql_3306shell> rm -rf datashell> ln -s data /data/mysql_13306

3. Specify user rights for the working directory

shell> cd mysql_13306shell> scripts/mysql_install_db --user=mysql   #这里可以指定mysql安装和安装数据的位置。 # --basedir=path 使用mysqld程序的路径 --datadir=path  数据库安装的路径#此脚本,默认执行的是#./bin/mysqld --bootstrap --basedir=. --datadir=/var/lib/mysql --logshell> chown -R root .shell> chown -R mysql /data/mysql_13306# 数据库数据位置需要拥有mysql的权限。不能设置为root权限。否则无法启动。

4. Modify configuration file to specify MySQL installation directory and data directory

主要设置参数,在mysqld下配置。[mysqld]  user =mysql                                 //以mysql用户权限运行mysql服务baseurl=/usr/loca/app/mysql_13306       //mysql二进制程序路径,默认为当前程序的./bin/mysqlddataurl=/data/mysql_13306/        //mysql数据库存放路径, 默认为/var/lib/mysql因为我们可能根据自己的数据安全,放在其他位置,可以将二进制里的data目录删除,然后建立一个软链接过去。然后设置data的属性为mysl.mysqlport=13306socket=/data/mysql_13306/mysql_13306.socket         //socket文件,默认路径为/var/lib/mysql/mysql.sockpid-file=/var/run/mysql_13306.pid        //如果没有指定,那么默认为$datadir/`hostname`.pid[mysqld_safe]log-error=/var/log/mysql_13306.log   

5. Start the server

shell> bin/mysqld --user=mysql &           # 或使用mysqld_safeshell> bin/mysqld_safe --user=mysql  & # 官方建议使用这个#启动可以用mysqld也可以使用mysqld_safe,区别简单点就是mysqld_safe比mysql更安全,因为mysqld_safe启动后会监控mysql服务状态做到自动重启mysql服务的功能,本质上用到的还是mysqld程序。#如果安装目录和数据库目录改变,添加相关参数

6. Add a startup script.

Precautions

1, different versions of the installation method is not the same. Refer to the official Installation instruction manual
2, the custom path, need to modify the relevant file related variables. Officially, the default path.

Mysql 5.6 Version Binary 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: 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.