当前位置:网站首页>【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
边栏推荐
- ES6 learning path (IV) operator extension
- Esp32 (6): Bluetooth and WiFi functions for function development
- Application of hongruan face recognition
- Express - static resource request
- 桂林 穩健醫療收購桂林乳膠100%股權 填補乳膠產品線空白
- Esp32 (7): I2S and I2C drivers for function development
- 5. Messager framework and imessager interface
- Tclistener server and tcpclient client use -- socket listening server and socketclient use
- Pass anonymous function to simplification principle
- Use V-IF with V-for
猜你喜欢

Duplicate entry '2' for key 'primary appears in JPA‘

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!

Installation, use and explanation of vulnerability scanning tool OpenVAS

Terminal -- Zsh of terminal three swordsmen

ES6 learning path (III) deconstruction assignment

Distributed ID

Clickhouse installation (quick start)

Cb/s Architecture - Implementation Based on cef3+mfc

Distributed things

9.JNI_ Necessary optimization design
随机推荐
Get to know handler again
(zero) most complete JVM knowledge points
Idea shortcut key settings
I'm late for school
Solution to the eighth training competition of 2020 Provincial Games
Talk about writing
12. problem set: process, thread and JNI architecture
Concatapter tutorial
About MySQL Boolean and tinyint (1)
Flutter theme (skin) changes
CentOS MySQL installation details
Numpy (constant)
Why must redis exist in distributed systems?
银河麒麟server-V10配置镜像源
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!
Reading notes of "Introduction to deep learning: pytoch"
What are the SQL add / delete / modify queries?
Small program learning path 1 - getting to know small programs
Esp32 things (II): sharpening the knife without mistaking firewood - make preparations before project development
Set, map and modularity