当前位置:网站首页>【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
边栏推荐
- Set, map and modularity
- Deep Learning with Pytorch- A 60 Minute Blitz
- Opencv learning notes-day5 (arithmetic operation of image pixels, add() addition function, subtract() subtraction function, divide() division function, multiply() multiplication function
- Solution to pychart's failure in importing torch package
- (zero) most complete JVM knowledge points
- Simple redis lock
- Pass anonymous function to simplification principle
- Common query and aggregation of ES
- Use of Baidu face recognition API
- Deep understanding of continuation principle
猜你喜欢

Applet learning path 2 - event binding

Wechat development tool (applet)

Tutorial for beginners of small programs day01

So the toolbar can still be used like this? The toolbar uses the most complete parsing. Netizen: finally, you don't have to always customize the title bar!

The elegant combination of walle and Jianbao

Idea shortcut key settings

asdsadadsad

Talk about how the kotlin process started?

Opencv learning notes -day2 (implemented by the color space conversion function cvtcolar(), and imwrite image saving function imwrite())

ES6 learning path (II) let & const
随机推荐
[protobuf] protobuf generates cc/h file through proto file
JVM family
Express file upload
Esp32 (7): I2S and I2C drivers for function development
Tutorial for beginners of small programs day01
DDD interview
qmlplugindump executable not found.It is required to generate the qmltypes file for VTK Qml
Golang magic code
仿照微信Oauth2.0接入方案
Couldn't load this key (openssh ssh-2 private key (old PEM format))
Invalid update: invalid number of sections. The number of sections contained in the table view after
Linear-gradient()
DataTableToModelList实体类
Distributed things
小程序开发踩坑之旅
POJ 1753 flip game (DFS 𞓜 bit operation)
Differences between the notify(), notifyall(), notifydatasetchanged(), notifydatasetinvalidated() methods in the adapter
Challenge transform() 2D
Opencv learning notes-day5 (arithmetic operation of image pixels, add() addition function, subtract() subtraction function, divide() division function, multiply() multiplication function
Installation, use and explanation of vulnerability scanning tool OpenVAS