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

Detailed explanation of the working principle and solution of Js modularization

Table of contents 1. Modular concept 2. Modulariz...

React's context and props explained

Table of contents 1. context 1. Usage scenarios 2...

Solution to data duplication when using limit+order by in MySql paging

Table of contents summary Problem Description Ana...

Analysis of the use of the MySQL database show processlist command

In actual project development, if we have a lot o...

The implementation principle of Tomcat correcting the JDK native thread pool bug

To improve processing power and concurrency, Web ...

In-depth understanding of CSS @font-face performance optimization

This article mainly introduces common strategies ...

JavaScript to achieve simple tab bar switching case

This article shares the specific code for JavaScr...

Detailed explanation of redundant and duplicate indexes in MySQL

MySQL allows you to create multiple indexes on th...

JS implements a simple todoList (notepad) effect

The notepad program is implemented using the thre...

Details of using Vue slot

Table of contents 1. Why use slots? 1.1 slot 1.2 ...

Design Theory: Textual Expression and Usability

<br />In text design, we usually focus on th...

Implementation of tomcat deployment project and integration with IDEA

Table of contents 3 ways to deploy projects with ...