当前位置:网站首页>【Ubuntu-MySQL8安装与主从复制】
【Ubuntu-MySQL8安装与主从复制】
2022-06-30 09:32:00 【浅浅望】
文章目录
一、安装
1.1 linux通用版安装
Linux安装MySQL8.x详细步骤
注:
关于 chkconfig --add mysql ,服务 mysql 不支持 chkconfig 的解决方法
Ubuntu下安装sysv-rc-conf报错:“E: Unable to locate package sysv-rc-conf“
1.2 apt 安装
05-ubuntu安装mysql8
Ubuntu 18.04 apt安装MySQL8.0
mysql 使用apt安装成功后:
1.2.1 设置mysql服务开机自启
systemctl enable mysql
1.2.2 授权mysql远程连接
二、主从复制
主库【ubuntu18.04 mysql8.0.29】
从库【windows mysql8.0.26】
2.1 主库
2.1.1 主库配置
文件路径:/etc/mysql/mysql.conf.d/mysqld.cnf
添加配置项:
[mysqld]
log-bin = mysql-bin #[必须]启用二进制日志
server-id = 1
2.1.2 为从库创建账户
注:mysql版本不一致,语句稍微有所不同,此处为mysql8.0.29
CREATE USER 'slave'@'%' IDENTIFIED WITH 'mysql_native_password' BY '123456';
GRANT REPLICATION SLAVE ON *.* TO 'slave'@'%';
上面指令创建一个用户slave,密码为123456,并赋予复制权限。
2.2 从库
2.2.1 从库配置
从库是windows
路径:在mysql安装目录下的my.ini文件
[mysqld]
#[必须]服务器唯一ID
server-id=2
重启mysql服务
2.2.2 修改同步数据库
CHANGE MASTER TO MASTER_HOST='192.168.1.101', #主服务器IP
MASTER_PORT=3306, #主服务器端口
MASTER_USER='user1', #主服务器用户名
MASTER_PASSWORD='userpwd', #主服务器用户密码
MASTER_LOG_FILE='mysql-bin.000001', #日志文件名,获取方法往下看
MASTER_LOG_POS=2235; #也从下面的方法获取
启动SLAVE进程:
start slave;
显示信息:
show slave status\G
边栏推荐
- Clickhouse installation (quick start)
- Explanation on the use of password profiteering cracking tool Hydra
- Express file download
- Opencv learning notes -day2 (implemented by the color space conversion function cvtcolar(), and imwrite image saving function imwrite())
- Couldn't load this key (openssh ssh-2 private key (old PEM format))
- Opencv learning notes-day9 opencv's own color table operation (colormap coloraptypes enumeration data types and applycolormap() pseudo color function)
- JVM family
- Alibaba billion concurrent projects in architecture
- 5. Messager framework and imessager interface
- Enum demo
猜你喜欢

Deep understanding of continuation principle

桂林 穩健醫療收購桂林乳膠100%股權 填補乳膠產品線空白

Numpy (time date and time increment)
![[shutter] solve failed assertion: line 5142 POS 12: '_ debugLocked‘: is not true.](/img/77/eb66ec83b34c251e732d495fbaa951.jpg)
[shutter] solve failed assertion: line 5142 POS 12: '_ debugLocked‘: is not true.

Mysq database remote connection error, remote connection is not allowed

Interviewer: do you understand the principle of recyclerview layout animation?

The elegant combination of walle and Jianbao

Deeply understand the working principle of kotlin collaboration suspend (beginners can also understand it)

Explanation on the use of password profiteering cracking tool Hydra

Idea setting automatic package Guide
随机推荐
Express の Hello World
Cftpconnection:: getfile() download FTP server files and related parameter descriptions
Solution to the sixth training competition of 2020 provincial competition
qmlplugindump executable not found.It is required to generate the qmltypes file for VTK Qml
Esp32 things (x): other functions
Harmonyos actual combat - ten thousand words long article understanding service card development process
Distributed session
桂林 稳健医疗收购桂林乳胶100%股权 填补乳胶产品线空白
Numpy (data type)
Deep Learning with Pytorch - autograd
Talk about how the kotlin collaboration process establishes structured concurrency
Review the old and know the new
Opencv learning notes-day14 drawing of image geometry (rect class rotatedrect class, rectangle drawing rectangle circle drawing circular function line drawing line function ellipse drawing elliptic fu
2021-10-20
Net framework system requirements
Niuke walks on the tree (ingenious application of parallel search)
Deep Learning with Pytorch-Train A Classifier
MySQL directory
[protobuf] protobuf generates cc/h file through proto file
How do I start? (continuously updating)