当前位置:网站首页>Centos7.2 通过rpm包安装Mysql5.7
Centos7.2 通过rpm包安装Mysql5.7
2022-07-15 20:01:00 【19921106】
此文章不再更新,点击下面链接查看最新文章与更多内容
《centos7 通过Yum安装MySql5.7并开启远程访问》
《centos7 MySql5.7 二进制源码安装并设置服务与自启动》
------------------------------------------------ 分割线 ----------------------------------------------
之前我写过一遍安装mysql5.6的文章,使用的是二进制源码安装,比较复杂,但是能熟悉mysql安装中的原理。有兴趣的可以参考
《CentOS7.2 安装mysql5.6,并配置自动启动和远程访问》
这里,我们不用那么复杂的方式,而是直接使用mysql的官方rpm包来直接安装,非常方便快捷,不出错。
官方下载地址: MySQL :: Download MySQL Community Server (Archived Versions) , 首先下载指定版本的rpm包,直接下载rpm所有需要的集合包,如图:

以下均为使用root用户操作
1. 删除mariadb
$ rpm -qa|grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64
## 上一步查出来的文件名,直接复制下来就OK,删除maridab
$ rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_642. 下载官方的yum仓库文件并安装
# 下载rpm包,网址可能会改变,以官网为准
wget https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar
# 解压
tar -xvf mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar
# 解压后会有很多rpm包,只需要其中四个,依次安装: common -> libs -> client -> server
rpm -ivh mysql-community-common-5.7.24-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.24-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.24-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.24-1.el7.x86_64.rpm安装的时候可能会报错:
安装libaio依赖即可
yum install libaio -y3. 修改mysql配置文件
vim /etc/my.cnf
# 具体的参数修改就自己根据自己的实际使用情况进行配置。4.启动mysql
# 设置自启动并启动服务
systemctl enable mysqld
systemctl start mysqld5. 开放防火墙
firewall-cmd --add-port=3306/tcp --permanent
firewall-cmd --reload6. 登陆mysql,并修改root密码,开启远程访问
# 启动后会生成一个默认密码,如果你没修改日志文件目录的话,执行下面语句查出初始密码
grep password /var/log/mysqld.log
2018-08-16T03:48:23.698636Z 1 [Note] A temporary password is generated for [email protected]: _G19lNt6v<x4
# 利用初始密码登陆mysql
mysql -u root -p
# 修改密码,mysql5.7的默认密码强度很高,需要有大小写,符号数字,长度大于6.
> alter user 'root'@'localhost' identified by 'your_password';
# 修改成功后,如果你不像要这么复杂的密码,修改密码强度设定为低登即的只判断密码长度。
> set global validate_password_policy=0;
# 重新修改密码
> alter user 'root'@'localhost' identified by 'new_password';
# 开启远程登陆
> grant all privileges on *.* to 'root'@'%' identified by 'new_password';
# 刷新权限设置
> flush privileges;ok,到此,你就可以在别的ip上通过root连接此mysql服务了。
边栏推荐
- C#将数据库连接方式写到配置文件中
- Tengshi's new luxury medium and large MPV is exposed, safe and comfortable
- 迪赛智慧数——柱状图(正负条形图):2022届毕业生不同城市的期望&实际薪资
- C writes the database connection mode to the configuration file
- 包过滤规则
- CSDN blog expert exclusive honor award is coming
- Codeforces Round #803 (Div. 2) C. 3SUM Closure
- Easy gene encode histone chip SEQ and transcription factor chip SEQ data standard and processing flow
- Unity shader - cginclude file cginc
- Power on, press F11, select one shot, and then select U disk to start
猜你喜欢

openGauss 联合产业界创新,共建开源数据库根社区

Scripting rules and variable definitions

构建数据基础制度,开启OID赛道新纪元

Codeforces Round #804 B Almost Ternary Matrix

Codeforces Round #803 (Div. 2) B. Rising Sand

nacos win10单机启动命令

Educational Codeforces Round 131 A - D

LeetCode-128-最长连续序列

LeetCode-83-删除链表中的重复元素

Codeforces Round #806 (Div. 4) A - G
随机推荐
Can you use redis? Then come and learn about redis protocol
一键生成VR全景图展示
华泰证券网上开户安全吗?资金有保障吗?
AIRIOT答疑第4期|如何使用數據分析引擎?
408天勤第八章排序课内代码合集
Codeforces Round #806 (Div. 4) A - G
网络地址转换
常用和实用的sql语句
怎么解决系统高并发问题的思路?看完你就彻底懂了。
求助,更新到思源 v2.0.27,dark+ 主题自适应宽度问题
Linux 离线安装 mysql 5.7
Educational Codeforces Round 131 A - D
Codeforces Global Round 21 A. NIT orz!
面试基础题
Nest framework
面试复盘2(面试回答不好的地方做总结)
Network information viewing and configuration
[mt2126] Digital Games
Airiot Q & A issue 4 | how to use data analysis engine?
Laravel 异步执行任务