当前位置:网站首页>canal 第四篇
canal 第四篇
2022-07-23 01:36:00 【Cynhard_Cheung】
1.检测系统是否已安装 mysql
yum list installed | grep mysql
2.删除系统已安装的 mysql 及其依赖
yum -y remove mysql-libs.x86_64
3.给CentOS添加rpm源,并且选择较新的源(安装wget:yum install -y wget)下不了就到官网上下载
wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm4
安装下载的 rpm 文件
yum install -y mysql-community-release-el6-5.noarch.rpm
安装成功后,我们可以看到/etc/yum.repos.d/目录下增加了以下两个文件
查看 mysql56 的安装源是否可用,如不可用请自行修改配置文件
(/etc/yum.repos.d/mysql-community.repo)使 mysql56 下面的 enable=1
yum repolist enabled | grep mysql
5.使用 yum 安装 mysql
yum install -y mysql-community-server
6.启动 mysql 服务
service mysqld start
查看 mysql 状态
service mysqld status
7.查看 mysql 是否自启动,并且设置开启自启动
#显示 mysql 服务在不同运行级的状态
chkconfig --list | grep mysqld
Linux OS 将操作 环境分为以下 7 个等级,即
0:关机
1:单用户模式(单用户、无网络)
2:无网络支持的多用户模式(多用户、无网络)
3:有网络支持的多用户模式(多用户、有网络)
4:保留,未使用
5:有网络支持有 X-Window 支持的多用户模式(多用户、有网络、X-Window 界面)
6:重新引导系统,即重启
#设定 mysqld 在各等级为 on
chkconfig mysqld on
8.创建用户,并授权远程登录
1) 设置 mysql root 用户密码
#Mysql 刚刚安装完成,默认 root 用户是没有密码的,登录 mysql 设置 root 用
户密码。第一次登陆默认没有密码,回车即可。
mysql -u root -p
#进入 mysql 后,输入如下命令设置 root 用户密码
set password for [email protected]=password(‘root’);
2)创建 canal 账号
create user ‘canal’ identified by ‘canal’;
create user ‘canal’@‘slave1’ identified by ‘canal’;
3)MySQL 账号授权
3-1 授权 slave1 节点通过 canal 用户访问数据库
GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON . TO ‘canal’@‘slave1’;flush privileges;
3-2 授权所有远程地址都可以通过 canal 用户访问数据库
GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON . TO ‘canal’@‘%’;
FLUSH PRIVILEGES;
4)查看 user 表的用户信息
select host ,user,password from mysql.user;
5)查看 mysql 版本
select version()
9.开启 Binlog 写入功能
对于自建 MySQL , 需要先开启 Binlog 写入功能,配置 binlog-format 为 ROW 模式,my.cnf
中配置如下:
vi /etc/my.cnf
[mysqld]
log-bin=mysql-bin # 开启 binlog
binlog-format=ROW # 选择 ROW 模式
server_id=1 # 配置 MySQL replaction 需要定义,不要和 canal 的 slaveId 重复
###################新版本linux 7上安装mysql 8#############
在CentOS 7上安装MySQL时遇到错误:
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
GPG key retrieval failed: [Errno 14] curl#37 - “Couldn’t open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022”
需要先运行下面的命令
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
再次执行MySQL的安装命令
yum install mysql-community-server
systemctl start mysqld
systemctl status mysqld
systemctl restart mysqld
开机启动
systemctl enable mysqld
systemctl daemon-reload
初始密码:
grep ‘temporary password’ /var/log/mysqld.log
vi /etc/my.cnf 添加下面四行
default-authentication-plugin=mysql_native_password
validate_password.check_user_name=OFF
validate_password.policy=LOW
validate_password.length=4
###########################
边栏推荐
- Vscode连接服务器,密码正确,但是一直连接不上的解决办法
- 求解最大公约数和最小公倍数
- Solution of equipment inspection in sewage treatment plant
- 事件侦听和删除事件——event对象——默认事件——取消冒泡事件——事件委托——默认触发
- 1058 A+B in Hogwarts
- MFC实现二叉树动画演示
- Sentry的安装、配置、使用
- [FPGA tutorial case 36] communication case 6 - development of FFT Fourier transform based on vivado core and detailed explanation of Verilog input timing configuration, which is verified by MATLAB
- PyG利用MessagePassing搭建GCN实现节点分类
- PNA肽核酸修饰多肽Z-Gly-Pro-pNA|D-Phe-Pip-Arg-pNA|Tos-Gly-Pro-Arg-pNA
猜你喜欢

The pit trodden by real people tells you to avoid the 10 mistakes often made in automated testing

RNA 25. What should we do if there is only Shengxin but no experiment in SCI articles?

IBM:到2030年实现容错量子优势

向后量子密码学迁移!美国NIST公布12家合作伙伴

Props and context in setup

TFW6524完美替代进口PT6524芯片方案简介

力扣(LeetCode)203. 移除链表元素(2022.07.22)

PNA肽核酸修饰多肽Pro-Phe-Arg-pNA (S-2302)|Dnp-Gly-X-L-Pro-Gly-pNA

复盘:pearson皮尔森相关系数和spearman斯皮尔曼相关系数的区别

Judge whether it is void type
随机推荐
BeanSearcher接收数组参数、以及逻辑删除
How to learn MySQL efficiently and systematically?
A ConvNet for the 2020s 论文阅读
购买股票开户安全吗,会亏钱吗?
SPSS Chi-Square
如何确定一个软件的测试结束点
Program environment and pretreatment
Advantages of server hosting, server leasing and virtual machine
Accumulation of FPGA errors
如何高效系统学习 MySQL?
肽核酸(PNA)偶联穿膜肽(CCPs)(KFF)3K形成CCPs-PNA|肽核酸的使用方法
IBM:到2030年实现容错量子优势
TFW6524完美替代进口PT6524芯片方案简介
Solution of equipment inspection in sewage treatment plant
程序员必须掌握的600个英语单词
How many points can you get on the latest UnionPay written test for test engineers?
使用递归字符串反转和全排列
pytorch简单示例汇总
Group before getting the maximum value in stream operation
Double disk: what is a b+ tree? Do you know how b+ trees build ordered tables? What are the characteristics of b+ tree