rhel7.2-based mysql5.7.13 installation and configuration
First, the experimental environment:
(1) Virtual machine: VMware Workstation 12
(2) Operating system: Rhel 7.2 x86_64
(3) Database: mysql5.7.13
Second, MySQL 5.7 main features:
Native Support Systemd
Better performance: Better optimizations for multicore CPUs, SSDs, locks
A better InnoDB storage engine
More robust replication capabilities: Replication leads to a scenario where data is not lost at all, and traditional financial customers can choose to use the MySQL database.
Note: Multi-threaded master-slave replication has been supported since the mysql5.6.3 version
New SYS library: This will be the most frequently accessed library for DBAs
Better optimizer: The meaning of the optimizer code refactoring will make a huge improvement in this and later releases, Oracle is addressing the biggest challenge before MySQL native JSON type support (JavaScript Object Notation)
Note: JSON (JavaScript Object Notation) is a lightweight data interchange format. JSON takes a completely language-independent text format, but also uses a similar idiom to the C language family (c, C + +, C #, Java, JavaScript, Perl, Python, and so on). These features make JSON an ideal data exchange language. Easy to read and write, but also easy to machine parse and generate (typically used to improve network transfer rates).
The JSON syntax is a subset of the JavaScript object representation syntax.
Data in key-value pairs
Data is separated by commas
Curly braces Save Object
Square brackets Save Array
Files written in JSON can be used in place of. Yaml format files. (In Docker kubernetes, create RC).
Third, view and delete the system's own database
[Email protected] ~]# uname-r
3.10.0-327.el7.x86_64
[Email protected] ~]# cat/etc/redhat-release
Red Hat Enterprise Linux Server Release 7.2 (MAIPO)
[Email protected] ~]# Rpm-qa |grep mariadb
Mariadb-libs-5.5.44-2.el7.x86_64
[Email protected] ~]# rpm-e mariadb-libs--nodeps
[Email protected] ~]# Rpm-qa |grep mariadb
note : Because centos7.2 has mariadb-libs installed by default, uninstall
First
First check if the system installs mariadb. Since the linux7 version is no longer supported by the MySQL RPM package installation, so there is no MySQL RPM package in the system disk, and starting from the LINUX7 version, the system will install the Mariadb-libs database by default, we will install MySQL database conflict, So we have to uninstall the mariadb-libs database first.
Iv. Dependent package Download
(1) The role of dependent packages
CMake: Since the general Configure compilation method is deprecated from the MySQL5.5 version, the CMake compiler is required to set the compilation parameters for MySQL. such as: installation directory, data storage directory, character encoding, sorting rules, etc.
Boost: Starting from MySQL 5.7.5 Boost library is required, MySQL source used in C + + Boost Library, requires the installation of boost1.59.0 or above version
GCC: Linux C language compiler tool, MySQL source code compiled by C and C + + written, requires the installation of GCC
Bison:linux down-C + + parser
Ncurses: Character Terminal processing library
(2) Installation file preparation
Download cmake-3.5.tar.gz
Download ncurses-5.9.tar.gz
Download bison-3.0.4.tar.gz
Download mysql-5.7.13.tar.gz
Download Boost_1_59_0.tar.gz
V. Dependent package Installation
(1) Installation CMake
[Email protected] ~]# CD/USR/SRC
[Email protected] src]# TAR-ZXVF cmake-3.5.2.tar.gz
[Email protected] src]# CD cmake-3.5.2
[Email protected] cmake-3.5.2]#/bootstrap && gmake && gmake Install
Note: If you have an error in the previous step, please install the following package:
[email protected] cmake-3.5.2]# Yum install-y gcc
[email protected] cmake-3.5.2]# Yum install-y gcc-c++.x86_64
Cmake–version---View cmake version
[Email protected] cmake-3.5.2]# cmake-version
CMake version 3.5.2
CMake Suite maintained and supported by Kitware (Kitware.com/cmake).
(2) Installation ncurses
[Email protected] src]# tar zxvf ncurses-5.9.tar.gz
[[email protected] ncurses-5.9]#./configure && make && make install
(3) Installation Bison
[Email protected] src]# TAR-ZXVF bison-3.0.4.tar.gz
[Email protected] src]# CD bison-3.0.4
[[email protected] bison-3.0.4]#./configure && make && make install
Note: If you have an error in the previous step, the following:
Error 1::checking for GNU M4 that supports accurate traces ... Configure:error:no acceptable M4 could is found in $PATH.
Installation:
[email protected] bison-3.0.4]# Yum install-y m4.x86_64
Error 2:configure:error:perl not found
[email protected] bison-3.0.4]# Yum install-y perl.x86_64
(4) Installation bootst
[Email protected] src]# TAR-ZXVF boost_1_59_0.tar.gz
[Email protected] src]# MV Boost_1_59_0/usr/local/boost
Vi. creating MySQL users and user groups and directories
(1) Creating MySQL users and user groups
[[email protected] ~]# groupadd-r mysql && useradd-r-g mysql-s/bin/false-m MySQL
Note: The above command means: new MySQL group and MySQL user prohibit login shell, the above command can also be written in the following form:
Useradd-r-s/sbin/nologin-m MySQL
-R indicates the creation of a system composition or system account.
Look at the MySQL account you created:
[[email protected] ~]# cat/etc/passwd |grep MySQL
Mysql:x:996:994::/home/mysql:/bin/false
(2) Create MySQL installation directory
[Email protected] ~]# Mkdir/usr/local/mysql
(3) The directory where the database is created
[Email protected] ~]# Mkdir/usr/local/mysql/data
Vii. compiling and installing MySQL and optimizing
(1) Unzip MySQL
[Email protected] src]# TAR-ZXVF mysql-5.7.13.tar.gz
(2) Compile and install MySQL
[Email protected] src]# CD mysql-5.7.13
[Email protected] mysql-5.7.13]# 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_archive_storage_ Engine=1-dmysql_unix_addr=/usr/local/mysql/mysql.sock-dwith_partition_storage_enging=1-dextra_charsets=all -ddefault_charset=uft8-ddefault_collation=uft8_general_ci -dwith-systemd=1-dwith_boost=/usr/local/boost && make && make install
Note: Do not write on the above bold font!
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/97/0D/wKioL1koLJ6SS_9CAAEP8Eecc1o323.png "title=" 11. PNG "alt=" Wkiol1kolj6ss_9caaep8eecc1o323.png "/>
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/97/0C/wKiom1koLDjgpIsoAALRutSv-rY521.jpg "title=" 11. JPG "alt=" wkiom1koldjgpisoaalrutsv-ry521.jpg "/>
Note: To rerun the CMake configuration, you need to delete the CMakeCache.txt file (that is, the previous configuration, compile, install after the error, we do not need to start over to delete the CMakeCache.txt file)
The steps are as follows:
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/97/0D/wKioL1koLcXDZkoPAAM86O5QVyM140.png "title=" 11. PNG "alt=" Wkiol1kolcxdzkopaam86o5qvym140.png "/>
(3) Optimize the execution path of MySQL:
[Email protected] mysql-5.7.13]# Vim/etc/profile
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/97/0C/wKiom1koL3PQQnsMAAANvtIrmV0717.png "title=" 11. PNG "alt=" Wkiom1kol3pqqnsmaaanvtirmv0717.png "/>
Add at the bottom: Export path= $PATH:/usr/local/mysql/bin
[Email protected] mysql-5.7.13]# Source/etc/profile
(4) Set permissions and initialize MySQL system authorization form
[Email protected] ~]# chown-r mysql:mysql/usr/local/mysql/
Initialize database, command:
[Email protected] ~]#/usr/local/mysql/bin/mysqld--initialize--user=mysql--basedir=/usr/local/mysql--datadir=/ Usr/local/mysql/data
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/97/99/wKiom1kwHIrCVCt0AABlFr9JcGU767.png "title=" Mysql2. PNG "alt=" Wkiom1kwhircvct0aablfr9jcgu767.png "/>
Note: In MySQL generate a default password: ry9v) W5IXJHL
Description: (after the 5.7.6 version can be installed mode or can use the non-installation mode)
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/8F/01/wKiom1jRHSGTd7IfAAMQupzlt9E097.jpg "title=" Image017.jpg "alt=" wkiom1jrhsgtd7ifaamqupzlt9e097.jpg "style=" Padding:0px;margin:0px;vertical-align:top;border: None;float:none; "/>
(5) In case, change one subordinate and group
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8E/FF/wKioL1jRHSLQuIMoAACcrXX2Y_A782.jpg "title=" Image018.jpg "alt=" wkiol1jrhslquimoaaccrxx2y_a782.jpg "style=" Padding:0px;margin:0px;vertical-align:top;border: None;float:none; "/>
(6) Creating a configuration file
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/8F/01/wKiom1jRHSLSB-aFAAGUOvkD7Tc893.jpg "title=" Image019.jpg "alt=" wkiom1jrhslsb-afaaguovkd7tc893.jpg "style=" Padding:0px;margin:0px;vertical-align:top;border: None;float:none; "/>
To modify the MY.CNF configuration file:
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/8E/FF/wKioL1jRHSKyq-glAAByWHXpkfE474.jpg "title=" Image020.jpg "alt=" wkiol1jrhskyq-glaabywhxpkfe474.jpg "style=" Padding:0px;margin:0px;vertical-align:top;border: None;float:none; "/>
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/8F/01/wKiom1jRHSXTk7mjAAaKeb8yaJA730.jpg "title=" Image021.jpg "alt=" wkiom1jrhsxtk7mjaaakeb8yaja730.jpg "width=" 650 "style=" padding:0px;margin:0px;vertical-align: Top;border:none;float:none; "/>
(7) Configure MySQL boot from boot
[Email protected] ~]# cd/usr/lib/systemd/system/
[Email protected] system]# vim Mysqld.service
The configuration file is as follows:
[Unit]
Description=mysql Server
After=network.target
[Service]
Execstart=/usr/local/mysql/bin/mysqld--defaults-file=/etc/my.cnf--datadir=/usr/local/mysql/data--socket=/usr/ Local/mysql/mysql.sock
User=mysql
Group=mysql
[Install]
Wantedby=multi-user.target
Quit, Save!
[Email protected] system]# systemctl daemon-reload # #重新载入systemd, scan for new or changed units and make them effective.
(8) Start MySQL again and check the status
[Email protected] system]# systemctl start Mysqld.service
[Email protected] system]# systemctl status Mysqld.service
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/97/99/wKiom1kwHhyTz2OAAABCRHDlhRQ365.png "title=" 11. PNG "alt=" Wkiom1kwhhytz2oaaabcrhdlhrq365.png "/>
[Email protected] mysql]# Ps-ef |grep mysqld
[[email protected] mysql]# NETSTAT-LNP |grep MySQL
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/97/9A/wKioL1kwH3bDYjffAAA5KNGs1-Y035.png "title=" 11. PNG "alt=" Wkiol1kwh3bdyjffaaa5kngs1-y035.png "/>
Viii. Accessing the database:
(1) Log in to the database with the default password
[Email protected] mysql]# mysql-u root-p ' ry9v) W5IXJHL '
(2) Modify the database password
Mysql> mysqladmin-uroot-p ' ry9v) W5IXJHL ' password ' 123456 '
Note:
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/97/9A/wKioL1kwIMGw-JgDAAEYYt6M-FI500.png "title=" 11. PNG "alt=" Wkiol1kwimgw-jgdaaeyyt6m-fi500.png "/>
This article is from the "Hand of the Paladin Control" blog, please make sure to keep this source http://wutengfei.blog.51cto.com/10942117/1931482
rhel7.2-based mysql5.7.13 installation and configuration