Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql5.7.13 Master-Slave deployment handout for centos6 system

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following mainly brings you the mysql5.7.13 master-slave deployment handout of the centos6 system. I hope the mysql5.7.13 master-slave deployment handout of the centos6 system can bring you practical use, which is also the main purpose of my editing this article. All right, don't talk too much nonsense, let's just read the following.

First, the experimental environment:

Two hosts install Centos6.7 32-bit operating system

Two Linux have the same version of MySQL installed, and mysql5.7.13 is used here

IP:192.168.100.129 of mysql1

IP:192.168.100.128 of mysql2

II. Deployment process:

Description:

For more details about the installation process of mysql, you can refer to the blog: http://wutengfei.blog.51cto.com/10942117/1931482, which simply writes down the brief steps for installing mysql5.7.13 in the linux6 version!

Third, view and delete the database that comes with the system

[root@mysql1 ~] # uname-r

2.6.32-573.el6.i686

[root@mysql1 ~] # cat / etc/redhat-release

CentOS release 6.7 (Final)

Fourth, rely on package download

(1) the role of related dependency packages

Cmake: since the regular configure compilation method has been deprecated from the MySQL5.5 version, a CMake compiler is required to set the compilation parameters for mysql. Such as: installation directory, data storage directory, character encoding, sorting rules and so on.

Boost: starting from MySQL 5.7.5, the Boost library is required. C++ 's Boost library is used in the mysql source code, and boost1.59.0 or above is required.

GCC: is a C language compilation tool under Linux. Mysql source code compilation is written entirely in C and C++. GCC is required to be installed.

C _ syntax + parser under bison:Linux

Ncurses: character terminal processing library

(2) preparation of installation documents

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

5. Dependent package installation

(1) install cmake

[root@localhost ~] # cd / usr/src

[root@ src] # tar-zxvf cmake-3.5.2.tar.gz

[root@ src] # cd cmake-3.5.2

[root@ cmake-3.5.2] # / bootstrap & & gmake & & gmake install

Note: if an error is reported in the previous step, please install the following package:

[root@localhost cmake-3.5.2] # yum install-y gcc-c++.i686

Cmake-version-View the cmake version

[root@ cmake-3.5.2] # cmake- version

Cmake version 3.5.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

(2) install ncurses

[root@ src] # tar zxvf ncurses-5.9.tar.gz

[root@ ncurses-5.9] # / configure & & make & & make install

(3) install bison

[root@ src] # tar-zxvf bison-3.0.4.tar.gz

[root@ src] # cd bison-3.0.4

[root@ bison-3.0.4] # / configure & & make & & make install

Note: if an error is reported in the previous step, it is as follows:

Error 1::checking for GNU M4 that supports accurate traces... Configure: error: no acceptable M4 could be found in $PATH.

Installation:

[root@localhost bison-3.0.4] # yum install-y m4.i686

Error 2:configure: error: perl not found

[root@localhost bison-3.0.4] # yum install-y perl.i686

(4) install bootst

[root@ src] # tar-zxvf boost_1_59_0.tar.gz

[root@ src] # mv boost_1_59_0 / usr/local/boost

Create mysql users and user groups and directories

(1) create mysql users and user groups

[root@] # groupadd-r mysql & & useradd-r-g mysql-s / bin/false-M mysql

Note: the above command means that new mysql groups and mysql users are prohibited from logging in to shell. The above command can also be written as follows:

Useradd-r-s / sbin/nologin-M mysql

-r means to create a system component or system account.

Take a look at the mysql account created:

[root@localhost ~] # cat / etc/passwd | grep mysql

Mysql:x:996:994::/home/mysql:/bin/false

(2) create a mysql installation directory

[root@ ~] # mkdir / usr/local/mysql

(3) create the directory where the database is located

[root@ ~] # mkdir / usr/local/mysql/data

7. Compile, install and optimize mysql

(1) decompress mysql

[root@ src] # tar-zxvf mysql-5.7.13.tar.gz

(2) compile and install mysql

[root@ src] # cd mysql-5.7.13

[root@ 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-DWITH-SYSTEMD=1-DWITH_BOOST=/usr/local/boost & & make & & make install

Note: to rerun the cmake configuration, you need to delete the CMakeCache.txt file (that is, there are errors found after the previous configuration, compilation and installation, so we don't have to start all over again and just delete the CMakeCache.txt file)

The steps are as follows:

(3) optimize the execution path of Mysql:

[root@ mysql-5.7.13] # vim / etc/profile

Add: export PATH=$PATH:/usr/local/mysql/bin at the bottom

[root@ mysql-5.7.13] # source / etc/profile

(4) set permissions and initialize MySQL system authorization table

[root@] # chown-R mysql:mysql / usr/local/mysql/

Initialize the database, command:

[root@localhost] # / usr/local/mysql/bin/mysqld-initialize-user=mysql-basedir=/usr/local/mysql-datadir=/usr/local/mysql/data

Note: in the figure above, mysql generates a default password: rY9V) w5ixjhL

(5) change the owner and group again just in case.

(6) create a configuration file

Modify the my.cnf configuration file:

(7) configure mysql to boot automatically

[root@mysql1 ~] # cd / usr/local/mysql

[root@mysql1 mysql] # cd support-files/

[root@mysql1 support-files] # cp mysql.server / etc/init.d/mysqld

[root@mysql1 ~] # vim / etc/init.d/mysqld

Add the following:

46 basedir= / usr/local/mysql

47 datadir= / uar/local/mysql/data

Quit and save!

[root@mysql1] # chkconfig-- add mysqld

[root@mysql1 ~] # chkconfig mysqld on

[root@mysql1 ~] # chkconfig-- list | grep mysqld

Mysqld 0: off 1: off 2: enable 3: enable 4: enable 5: enable 6: close

(8) start mysql again and check the status

[root@mysql1 ~] # / etc/init.d/mysqld status

[root@mysql1 ~] # netstat-lnp | grep mysqld

8. Access the database:

(1) Log in to the database with the default password

[root@localhost mysql] # mysql-u root-p 'rY9V) w5ixjhL'

(2) modify the database password

Mysql > set password = password ('123456')

Description: another mysql database installation steps are the same as above!

At this point, the linux6-based mysql5.7 version of the database installation is complete!

For the above mysql5.7.13 master-slave deployment handout for centos6 system, do you think it is very helpful? If you need to know more, please continue to follow our industry information. I'm sure you'll like it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report