MySQL 5.6.37 Source Compilation installation

Source: Internet
Author: User
Tags php language memcached mongodb

MySQL 5.6.37 Compile and install what is a database?

Simply put, the database is a repository of data, which is organized and stored according to a certain data structure (data structure refers to the organization or data), and we can manage the data in the database through various methods provided by the data.

Types of databases

According to the early database theory, there are three kinds of database models, which are hierarchical database, network database and relational database, and in today's Internet, the most commonly used database models are two kinds, namely relational database and non-relational database.

What is a relational database?

The relational database model boils down to a simple two-element relationship (i.e., a two-dimensional tabular form) of complex data structures. For example, the old boy education of a certain period of student relations is a two-dollar relationship. In the relational database, the operation of the data is almost entirely based on one or more relational tables, and the data is managed by the operation of the table classification, merging, connection, or selection of these relationships.
Relational databases have been around for more than more than 40 years, from theoretical development to display products such as the most common MySQL and Oracle databases in the world, Oracle has risen to the forefront in the field of databases, creating a huge industrial market of up to $ tens of billions of a year, MySQL is also a database that cannot be ignored, so it is bought by Oracle.

-Two-dimensional table
-For MySQL, Oracle database, the most common use of Internet operations is MySQL.
-Access and manage data through SQL Structured Query language.
-Strong in maintaining data consistency. Acid theory.

-relational databases have the following relationships: one-to-many-a-to-many.

What is a non-relational database?

The non-relational database is also called a NoSQL database, note that NoSQL is meant to be "not-only SQL", referring to the non-relational database, not the meaning of "No SQL" (no SQL statement?). , therefore, NoSQL is not to completely negate the relational database, but as an effective complement to the traditional relational database. NoSQL databases can perform unimaginable efficiencies and high performance in specific scenarios.

-NoSQL is not a negative relational database, but rather an important complement to a relational database.
-NoSQL for high performance, high concurrency, ignoring the impact of high-performance, high concurrency features.
-NoSQL Typical product memcached (pure memory), Rcdis (persistent cache), MongoDB

Classification of non-relational databases:

-Key-value storage database, typical database: memcached, Redis, etc.
-Columnstore databases, typical databases are: Cassandra, hbase, etc.
-For document databases, typical databases are: MongoDB, etc.

Reasons to select MySQL Database

-MySQL performance is excellent and service is stable. There are few unusual outages.
-MySQL Open source code without copyright restrictions, autonomy and low cost of use.
-MySQL has a long history, community and users are very active, encounter problems, can ask for help.
-MySQL software is small in size, easy to install and easy to Winho, low in installation and maintenance.
-MySQL brand effect, so that enterprises do not have to consider the direct use of lamp,lemp popular architecture
-MySQL supports a variety of operating systems, provides a variety of API interfaces, support a variety of development languages, especially for the popular PHP language has a good support.

Some of the recommendations of the enterprise using MySQL database:

-Stable version: Select Open Source community version of the stable version of Ga.
-Product line: You can choose 5.1 or 5.5. Internet company mainstream 5.5, followed by 5.1 and 5.6
-Select the GA version 6 months after the release of the MySQL database GA version.
-To choose a version that does not have a big bug fix for months and weeks, rather than a centralized version that fixes bugs a lot.
-It is best not to update the published version for a long time.
-Consider whether the version used by the developer developer is compatible with the version you choose.
-As an in-house development Test Database environment, run for about 3-6 months.
-Priority enterprise Non-core business adoption of a new version of the database GA version software.
-Consult with a DBA master, or in a group with a good technical atmosphere, and communicate with everyone, using the GA version products that the real masters have used.
-After the above procedure, if there is no important feature bug or performance bottleneck, you can start to consider the back-end database software as any business data service.

Installation Environment Preparation
Host Name Ip Z Host Description
Docker-1 192.168.56.11 MySQL master server
Docker-2 192.168.56.12 MySQL slave server
Lab Environment Check
[[email protected] src]# IP a #查看IP地址1: lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State UNKNOWN Qlen 1 link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever pref Erred_lft Forever Inet6:: 1/128 scope host Valid_lft forever Preferred_lft Forever2:eth0: <broadcast,multica St,up,lower_up> MTU Qdisc Pfifo_fast State up Qlen, Link/ether 00:0c:29:dd:9e:d9 BRD ff:ff:ff:ff:ff:ff I NET 192.168.56.11/24 BRD 192.168.56.255 scope global eth0 Valid_lft forever Preferred_lft Forever Inet6 fe80::20c : 29ff:fedd:9ed9/64 scope link Valid_lft forever preferred_lft forever3:eth1: &LT;BROADCAST,MULTICAST,UP,LOWER_UP&G T MTU Qdisc Pfifo_fast State up Qlen link/ether 00:0c:29:dd:9e:e3 BRD ff:ff:ff:ff:ff:ff[[email protected] src]# [[email protected] src]# cat/etc/redhat-release #查看系统版本CentOS Linux release 7.3.1611 (Core) [[EMAIL&NBSP;PR Otected] Src]#[[email protected] src]# hostname #查看主机名docker -1[[email protected] src]#[[email protected] ~]# ntpdate Time1.alyun.com #同步时间, Docker-2 also need to be synchronized
Software preparation
[Email protected] etc]# cd/usr/local/[[email protected] src]# wget https://dev.mysql.com/get/Downloads/MySQL-5.6/ mysql-5.6.37.tar.gz  #下载MySQL的源码包 [[email protected] src]# tar xf mysql-5.6.37.tar.gz #将下载的源码包解压到本地 [email Protected] src]# lltotal 31452drwxr-xr-x 7161 31415 4096     Sep 11:38 mysql-5.6.37-rw-r--r--  1 root root  32 200158 June  2 23:54 mysql-5.6.37.tar.gz[[email protected] mysql-5.6.37]# ID mysql  #检查系统是否存在mysql用户id: mysql:no Such user     #如果不存在则创建mysql用户 [[email protected] mysql-5.6.37]# groupadd-g 550 MySQL [[email protected] mysql-5.6.37]# u Seradd-g mysql-u 550 Mysql[[email protected] mysql-5.6.37]# ID mysqluid=550 (mysql) gid=550 (MySQL) groups=550 (MySQL)

Install pre-compilation dependencies

[[email protected] mysql-5.6.37]# Yum install cmake autoconf wget gcc-c++ gcc ncurses-devel-y[[email protected] src]# CD mysql-5.6.37/cmake-dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/usr/local/mysql/data-dsysconfdir=/ Etc-dwith_myisam_storage_engine=1-dwith_innobase_storage_engine=1-dwith_memory_storage_engine=1  -DMYSQL_ Unix_addr=/var/run/mysql/mysqld.sock-dmysql_tcp_port=3306-denabled_local_infile=1-dwith_partition_storage_ Engine=1-dextra_charsets=all  -ddefault_charset=utf8  -ddefault_collation=utf8_general_ci after the execution of CMake, The whole process of making and making install takes a long time, please wait a moment!

Detailed compilation parameters

-dcmake_install_prefix=/usr/local/mysql \ #安装路径-dmysql_datadir=/usr/local /mysql/data \ #数据文件存放地-dsysconfdir=/etc \ #配置文件my. CNF storage-dwith_myisam_storage_engine=1 \ #支持MyIASM引擎-DW ith_innobase_storage_engine=1 \ #支持InnoDB引擎-dwith_memory_storage_engine=1 \ #支持Memory引擎-dmysql_unix_addr=/var/ Run/mysql/mysqld.sock \ #连接数据库socket路径-dmysql_tcp_port=3306 \ #数据库端口号-denabled_local_infile=1 \ #允许从本地导入数据-  dwith_partition_storage_engine=1 \ #安装支持数据库分区-dextra_charsets=all \ #安装所有的字符集-ddefault_charset=utf8 \ #默认字符 -ddefault_collation=utf8_general_ci 

[[email protected] local]# Cd/usr/local/mysql[[email protected] mysql]# ll #编译后的文件total 48drwxr-xr-x 2 root Root 4096 Sep 12:17 bin-rw-r--r-- 1 root root 17987 June 3 01:42 copyingdrwxr-xr-x 3 root root + Se P 12:17 datadrwxr-xr-x 2 root root 12:17 Sep docsdrwxr-xr-x 3 root root 4096 Sep 12:17 includ Edrwxr-xr-x 3 root root 4096 Sep 12:17 libdrwxr-xr-x 4 root root ( Sep) 12:17 mandrwxr-xr-x Oot root 4096 Sep 12:17 mysql-test-rw-r--r-- 1 root root 2496 June 3 01:42 readmedrwxr-xr-x 2 Root root Sep 12:17 scriptsdrwxr-xr-x root root 4096 Sep 12:17 sharedrwxr-xr-x 4 root root 4096 Sep 12:17 sql-benchdrwxr-xr-x 2 root root ( Sep) 12:17 support-files[[email protected] mysql]# Chow N-r Mysql.mysql * #对当前目录授权
Database initialization
The my.cnf file needs to be modified before initialization, with the following contents: [[email protected] src]# less/etc/my.cnf[mysql]socket=/var/lib/mysql/ mysql.sockdefault-character-set=utf8[mysqld]skip-grant-tablesexplicit_defaults_for_timestamp= Trueskip-name-resolveport = 3306socket=/var/lib/mysql/mysql.sockbasedir=/usr/local/mysqlmax_connections = 200default-storage-engine=innodblower_case_table_names=1max_allowed_packet=16mlog-error=/var/log/mysql/ Mysql.logpid-file=/var/run/mysql/mysql.pid!includedir/etc/my.cnf.d[[email protected] mysql]#./scripts/ mysql_install_db--user=mysql--datadir=/usr/local/mysql/data--no-defaults #开始初始化此时MySQL还是启动不了, and some follow-up action is required [email  protected] mysql]# CP./support-files/mysql.server/etc/init.d/mysql #拷贝启动文件 [[email protected] mysql]# chmod +x/etc/init.d/mysql [[email protected] mysql]#/etc/init.d/mysql start #启动报错了Starting mysql.logging to '/var /log/mysql/mysql.log '. 170916 12:28:00 mysqld_safe Directory '/var/lib/mysql ' for UNIX socket file don ' t exists. error! The server quit without Updating PID file (/var/run/mysql/mysql.pid). [[email protected] mysql]# mkdir/var/lib/mysql[[email protected] mysql]# mkdir/var/log/mysql/-p[[email  protected] mysql]# chown-r mysql.mysql/var/log/mysql[[email protected] mysql]# mkdir/var/run/mysql[[ Email protected] mysql]# chown mysql/var/run/mysql[[email protected] mysql]# chown-r mysql.mysql/var/lib/ Mysql/[[email protected] mysql]#/etc/init.d/mysql start #再次启动Starting MySQL.    success!  #成功 [[email protected] mysql]#[[email protected] mysql]# PS aux|grep mysql #查看mysql进程root 49621 0.0 0.0    107904 660 pts/1 s+ 12:30pm 0:00 tailf/var/log/mysql/mysql.logroot 50215 0.0 0.0 113268 1588 pts/0 S 12:31 0:00/bin/sh/usr/local/mysql/bin/mysqld_safe--datadir=/usr/local/mysql/data--pid-file=/var/run/mysql/ Mysql.pidmysql 50464 1.5 11.8 1307016 457068 pts/0 Sl 12:31 0:00/usr/local/mysql/bin/mysqld--basedir=/usr/loca L/mysql--datadir=/usr/local/mySql/data--plugin-dir=/usr/local/mysql/lib/plugin--user=mysql--log-error=/var/log/mysql/mysql.log--pid-file=/   Var/run/mysql/mysql.pid--socket=/var/lib/mysql/mysql.sock--port=3306root 50489 0.0 0.0 112660 964 pts/0 R+ 12:32 0:00 grep--color=auto mysql[[email protected] bin]# vim/etc/profile.d/mysql.sh #设置mysql环境变量export PATH= /usr/local/mysql/bin: $PATH [[email protected] bin]# source/etc/profile #修改数据库密码/usr/local/mysql/bin/ mysqladmin-u root password ' new-password '/usr/local/mysql/bin/mysqladmin-u root-h 192.168.56.11 password ' new-passwor  d ' #登录数据库 [[email protected] ~]# mysql-uroot-p-h127.0.0.1enter Password: #输入设置的密码Welcome to the MySQL monitor. Commands End With; or \g.your MySQL connection ID is 1Server version:5.6.37 Source distributioncopyright (c) $, Oracle and/or its a Ffiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respecTiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql> mysql> show databases;+--------------------+| Database |+--------------------+| Information_schema | | MySQL | | Performance_schema | | Test |+--------------------+4 rows in Set (0.01 sec)

Hopefully this article will help you ^_^

MySQL 5.6.37 Source Compilation installation

Related Article

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.