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

How to install Mysql5.6 in Linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces you how to install Mysql5.6 in Linux, the content is very detailed, interested friends can refer to, hope to be helpful to you.

1.2 create mysql users and groups

Groupadd-r-g 306 mysqluseradd-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/localln-s mysql-5.6.40-linux-glibc2.12-x86_64 mysql

1.5 modify the permissions of the master and group to which you belong

Chown-R mysql.mysql / usr/local/mysql-5.6.40-linux-glibc2.12-x86_64chown mysql.mysql / usr/local/mysql

1.6 create a directory and modify the master of the mysql directory

Mkdir-p / data/mysql {, _ binlog} chown-R mysql.mysql / data/mysqlchown-R mysql.mysql / data/mysql_binlog

1.7 create a profile directory

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

1.8Profiles vim / etc/mysql/my.cnf

[client] port = 3306socket = / data/mysql/ mysql.sock [mysqld] port = 3306user = mysqlbasedir = / usr/local/mysqldatadir = / data/mysqlsocket = / data/mysql/mysql.sockpid-file = / data/mysql/mysql.pidlog-error = / data/mysql/mysql_error.logcharacter-set-server = utf8init_connect='SET NAMES utf8'innodb_log_file_size = 256Minnodb_file_format = barracudainnodb_strict_mode = 0innodb_file_per_table = on# Skip hostname resolution skip-name-resolve# server ID Cluster required configuration, distinguishing machine numbers, different for each machine server_id = opening binary logs, row-level records, writing synchronously to disk log_bin = / data/mysql_binlog/mysql-binbinlog_format = rowsync_binlog = 1sqlwriting modes opening STRICTTRANSrecords TABLESNOUND ZERONINTATENOROEZEROBYBYER ZEROLING NOUTOTOCRERED

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 a database file

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 Security initialization

Ln-s / data/mysql/mysql.sock / tmp/mysql.sockmysql_secure_installationroot has no password-- > enter directly-- > whether to set password Y to enter password-- > whether to delete anonymous user Y-- > whether to disable root remote connection N-- > whether to delete test test database Y-- > whether to reload database Y-- > OK

2.3 Master-Slave replication Architecture

2.3.1 profile

Master master database

Log_bin=/bin_log_PATH/mysql-bin enables binary logging binlog _ format = row binary logging mode, row-level logging server_id = 1

2.3.2 create a dedicated user for master-slave replication

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

2.3.3 refresh the binary log

Mysql > reset master;mysql > show master status

2.3.3 slave slave database configuration file

Server_id=2

2.4 establish master-slave association

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 on how to install Mysql5.6 in Linux to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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