MySQL 5.6 binary installation process under Linux

MySQL 5.6 binary installation process under Linux

1.1 Download the binary installation package

wget https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz

1.2 Create mysql user and group

groupadd -r -g 306 mysql
useradd -r -g 306 -u 306 -m -s /sbin/nologin mysql

1.3 Decompression

 tar xf mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz -C /usr/local

1.4 Create a mysql soft connection

cd /usr/local
ln -s mysql-5.6.40-linux-glibc2.12-x86_64 mysql

1.5 Modify the owner and group permissions

chown -R mysql.mysql /usr/local/mysql-5.6.40-linux-glibc2.12-x86_64
chown mysql.mysql /usr/local/mysql

1.6 Create a directory and modify the owner of the mysql directory

mkdir -p /data/mysql{,_binlog}
chown -R mysql.mysql /data/mysql
chown -R mysql.mysql /data/mysql_binlog

1.7 Create a configuration file directory

mkdir /etc/mysql/
cp /usr/local/mysql/support-files/my-default.cnf /etc/mysql/my.cnf

1.8 Configuration file vim /etc/mysql/my.cnf

[client]
port = 3306
socket = /data/mysql/mysql.sock
[mysqld]
port = 3306
user = mysql
basedir = /usr/local/mysql
datadir = /data/mysql
socket = /data/mysql/mysql.sock
pid-file = /data/mysql/mysql.pid
log-error = /data/mysql/mysql_error.log
character-set-server = utf8
init_connect='SET NAMES utf8'
innodb_log_file_size = 256M
innodb_file_format = barracuda
innodb_strict_mode = 0
innodb_file_per_table = on
#Skip host name resolution skip-name-resolve
#Server ID, a required configuration for the cluster, distinguish the machine number, each machine has a different server_id = 1
#Open binary log, row-level logging, synchronous writing to disk log_bin = /data/mysql_binlog/mysql-bin
binlog_format = row
sync_binlog = 1
sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
symbolic-links=0

1.9 Modify the PATH environment variable

]# vim /etc/profile.d/mysql.sh
    PATH=/usr/local/mysql/bin:$PATH
]# source /etc/profile.d/mysql.sh

2.0 Create database files

cd /usr/local/mysql/
./scripts/mysql_install_db --datadir=/data/mysql --user=mysql

2.1 Prepare the startup script

cd /usr/local/mysql/
./scripts/mysql_install_db --datadir=/data/mysql --user=mysql

2.2 Secure Initialization

ln -s /data/mysql/mysql.sock /tmp/mysql.sock
mysql_secure_installation
root has no password --> Press Enter --> Set a password Y Enter the password --> Delete anonymous users Y --> Disable root remote connection N --> Delete the test database Y --> Reload the database Y ---> OK

2.3 Master-slave replication architecture

2.3.1 Configuration File

master master database

log_bin=/bin_log_PATH/mysql-bin turns on binary log binlog_format = row binary log recording mode, row-level recording server_id = 1

2.3.2 Create a user with special permissions for master-slave replication

mysql> grant replication salve on *.* to 'repluer'@'172.16.1.%' identified by '123456'

2.3.3 Refresh binary log

mysql> reset master;
mysql> show master status; 

2.3.3 slave database configuration file

server_id=2

2.4 Establishing a master-slave relationship

mysql> change master to master_host='172.16.1.211',
master_user='repluser',master_password='123456',
master_log_file='mysql-bin.000001',master_log_pos=120;

2.4.1 View and enable slave nodes

mysql> start slave;
mysql> show slave status\G

Note: The master-slave replication architecture is to synchronize the data of a master with multiple slaves, which may cause great pressure on the master node. You can use master-slave cascade replication, where the master node is responsible for one slave node, and the slave node is responsible for the next slave node.

Mainly used configuration

Slave node configuration log_bin binary logging configuration

log_slave_updates writes the synchronized data into the binary log to facilitate synchronization with the next slave node

Summarize

The above is the MySQL 5.6 binary installation process under Linux introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • MySQL 5.6.24 (binary) automatic installation script under Linux
  • MySQL 5.7.18 binary package installation tutorial under Linux (without default configuration file my_default.cnf)
  • Detailed steps to install MySQL 8.0.27 in Linux 7.6 binary

<<:  Linux yum package management method

>>:  How to install Linux online software gcc online

Recommend

Simple method to install mysql under linux

When searching online for methods to install MySQ...

Installation tutorial of MySQL 5.7.17 zip package version under win10

The installation tutorial of mysql5.7.17 is share...

VMWare15 installs Mac OS system (graphic tutorial)

Installation Environment WIN10 VMware Workstation...

Detailed explanation of CSS BEM writing standards

BEM is a component-based approach to web developm...

React + Threejs + Swiper complete code to achieve panoramic effect

Let’s take a look at the panoramic view effect: D...

A brief discussion on when MySQL uses internal temporary tables

union execution For ease of analysis, use the fol...

Docker builds python Flask+ nginx+uwsgi container

Install Nginx First pull the centos image docker ...

Examples of correct use of interface and type methods in TypeScript

Table of contents Preface interface type Appendix...

In-depth analysis of Vue's responsive principle and bidirectional data

Understanding object.defineProperty to achieve re...

WeChat applet implements simple calculator function

This article shares the specific code for the WeC...

sql script function to write postgresql database to implement parsing

This article mainly introduces the sql script fun...

Linux disk space release problem summary

The /partition utilization of a server in IDC is ...

MySQL spatial data storage and functions

Table of contents 1. Data Type 1. What is MySQL s...