当前位置:网站首页>Linux基础 —— CentOS7 离线安装 MySQL
Linux基础 —— CentOS7 离线安装 MySQL
2022-07-01 22:52:00 【繁依Fanyi】
大数据系列文章:目录

一、安装前准备
1. MySQL rpm 包准备
① 打开 MySQL 下载页面,选择自己想要的版本即可
- MySQL 下载页面链接:https://dev.mysql.com/downloads/mysql/
- 阿里云 MySQL 镜像(推荐):https://mirrors.aliyun.com/mysql/?spm=a2c6h.13651104.0.0.712126b0xBBqsR

② 找到自己想要安装的版本,点击下载即可。

2. CentOS7 环境准备
详细安装方法可见下文:
| 内容 | 链接 |
|---|---|
| CentOS 安装 | 大数据环境搭建 —— CentOS 安装 |
3. XShell 与 Xftp
白嫖过程可见下文:
| 内容 | 链接 |
|---|---|
| 工具获取 — XShell | Linux基础 —— XShell 免费获取指南 |
二、开始安装
1. 卸载 MySQL
为了保险起见,防止之前安装过的 MySQL 与现在的 MySQL 产生冲突,就先卸载一遍 MySQL。
① 查看 MySQL 依赖
rpm -qa | grep mysql
如果找到什么,要进行下一步的卸载,如果没有,就不用了。

② 卸载 MySQL
rpm -e --nodeps `rpm -qa | grep mysql`
2. 发送 MySQL 安装包到节点主机上
① 建立 ftp 连接
这里使用 sftp 协议将文件传送到节点上,打开 xftp ,填写信息,建立链接。

② 发送安装包文件
将 MySQL 安装包拖入到想要放入的目录即可。

3. 安装 MySQL 安装包
cd 进入安装目录,安装 MySQL 安装包。
# rpm -ivh + 包名
rpm -ivh MySQL-server-5.1.73-1.glibc23.x86_64.rpm
rpm -ivh MySQL-client-5.1.73-1.glibc23.x86_64.rpm
三、简单配置
1. 配置开机启动
service mysql start
chkconfig mysql on
2. 修改 MySQL 密码
由于这里安装的是 5.6 以下版本,下面的操作只对 5.6 以下版本可行
① 输入 mysql 进入 MySQL
mysql
② 操作数据库修改密码
use mysql; # 切换数据库
user set password=password('123456') where user='root' and host='localhost'; # 修改密码为 123456
flush privileges # 配置生效
exit #退出 MySQL
3. 配置允许远程访问
use mysql; # 切换数据库
update user set host = '%' where user = 'root'; # 配置允许远程主机访问 root
flush privileges # 配置生效
如果报错可以忽略,再次查询 user 表,会发现 % 是被添加进去的。


边栏推荐
猜你喜欢

2022 R1 fast opening pressure vessel operation test questions and answers

2022年危险化学品经营单位安全管理人员考试题及在线模拟考试

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received

RPA: Bank digitalization, business process automation "a small step", and loan review efficiency "a big step"

Use 3DMAX to make a chess piece

Cisco -- highly available and reliable network examination

Three development trends of enterprise application from the perspective of the third technological revolution

Glass mosaic

玻璃马赛克
![Jielizhi Bluetooth headset quality control and production skills [chapter]](/img/3e/571d246d211a979e948dae1de56e93.png)
Jielizhi Bluetooth headset quality control and production skills [chapter]
随机推荐
Airserver latest win64 bit personal screen projection software
毕业季,既是告别,也是新的开始
[JUC learning road day 8] condition
y53.第三章 Kubernetes从入门到精通 -- ingress(二六)
Leetcode(34)——在排序数组中查找元素的第一个和最后一个位置
共享电商的背后: 共创、共生、共享、共富,共赢的共富精神
Redis~02 cache: how to ensure data consistency in MySQL and redis when updating data?
Cisco test -- the concept and configuration test of routing
Zhongang Mining: it has inherent advantages to develop the characteristic chemical industry dominated by fluorine chemical industry
What are the benefits of third party acceptance testing? Recommended by professional third-party software testing institutions
Who do you want to know when opening a stock account? Is it safe to open an account online?
硅谷产品实战学习感触
[kotlin third party] coil koltin collaboration picture loading library coil glide like picture loading third party
Advanced skills of testers: a guide to the application of unit test reports
有些能力,是工作中学不来的,看看这篇超过90%同行
2022安全员-C证考试题模拟考试题库及模拟考试
Data enhancement of semi supervised learning
数字化转型道阻且长,如何迈好关键的第一步
每日三题 6.30(2)
What is the mosaic tailgate?