Centos7 MySQL installation master-slave replication configuration
Installation Dependency
yum search libaio
yum install libaio
Is mysql installed
yum list installed | grep mysql
mysql uninstall
yum -y remove mysql-libs.x86_64
mysql yum Download
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Modify Startup Project
yum-config-manager --disable mysql56-community
yum-config-manager --enable mysql57-community-dmr
Install MySQL
yum install mysql-community-server
View mysql installation location
whereis mysql
mysql start
systemctl start mysqld
Close mysql
systemctl stop mysqld
View Password
grep 'temporary password' /var/log/mysqld.log
mysql modify password remote connection
SET PASSWORD = PASSWORD('#20as3SElksds0ew98');
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '#20as3SElksds0ew98' WITH GRANT OPTION;
Master-slave replication
open port
firewall-cmd –add-port=3306/tcp
firewall-cmd –permanent –add-port=3306/tcp
firewall-cmd –reload success
Modify Master Server - vim/etc/My.cnfAdd at the end
log-bin=mysql-bin #slaveWill be based on thislog-binTo do replication
server-id=1 #masterSign
innodb_flush_log_at_trx_commit=1
sync_binlog=1
Modify slave server - vim/etc/My.cnfAdd at the end
Flag for server-id=2 #slave
Flag for server-id=3 #slave
Several are configured on just a few
Primary Server Add Account
Main Service View Information
show master status;
+------------------+----------+--------------+------------------+-------------------+
Configure Slave Server
stop slave;
change master to master_user='root',master_password='#20as3SElksds0ew98',master_host='192.168.232.140',master_port=3306,master_log_file='mysql-bin.000002',master_log_pos=673
start slave;
Tags:
MySQL
yum
firewall
vim
Posted on Wed, 27 May 2020 12:13:11 -0400 by kmemis