失效链接处理 |
MySQL主从复制 PDF 下载
本站整理下载:
相关截图:
主要内容:
1、基础设置准备
2、安装mysql数据库
#操作系统:
centos 7.5
#mysql版本:5.7.33
#两台虚拟机:
mysql01:192.168.147.11(主)
mysql02:192.168.147.12(从)
systemctl stop firewalld.service
systemctl disable firewalld.service
cd /usr/local/
tar zxf mysql-5.7.33-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.7.33-linux-glibc2.12-x86_64 mysql5.7
cd mysql5.7/
mkdir data
mkdir logs
touch logs/mysqld.log
root@0004 local]# vi /etc/my.cnf
[mysqld]
basedir=/usr/local/mysql5.7/
datadir=/usr/local/mysql5.7/
datasocket=/usr/local/mysql5.7/mysql.sock
user=root
symbolic-links=0
lower_case_table_names=1
max_connections=200
character-set-server=utf8
default-storage-engine=INNODB
max_allowed_packet=16M [client]
port=3306
socket=/usr/local/mysql5.7/mysql.sock
[mysqld_safe]log-error=/usr/local/mysql5.7/logs/mysqld.log
pid-file=/usr/local/mysql5.7/logs/mysqld.pid
# 初始化
mysqlbin/mysqld --initialize --user=root --basedir=/usr/local/mysql5.7/ --datadir=/usr/local/mysql
# 启动
cp /usr/local/mysql5.7/support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
service mysqld start
# 添加环境变量
3、在两台数据库中分别创建数据库
4、在主(mysql01)服务器进行如下配置:
5、在主服务器上配置从服务器登录主服务器的账号授权
vim /etc/profile
# MYSQL
export MYSQL_HOME="/usr/local/mysql5.7/"
export PATH="$PATH:$MYSQL_HOME/bin"
source /etc/profile
# 登陆 ,使用初始化时候生成的密码
mysql -uroot -ph)tyPFj3DxiG
# 修改默认密码
mysql> alter user 'root'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
# 创建远程用户
mysql> use mysql;
mysql> select host,user from user;
mysql> create user 'root'@'%' identified by '123456';
|