当前位置:网站首页>Centos7--MySQL的安装
Centos7--MySQL的安装
2022-08-01 21:29:00 【不想秃头的小杨】
1.准备条件
首先在虚拟机中安装一个Centos7(VM虚拟机安装Centos7)
2.MySQL安装
2.1下载wget命令
yum -y install wget
2.2在线下载mysql安装包
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
2.3 安装mysql服务
2.3.1首先进入cd /etc/yum.repos.d/
目录。
cd /etc/yum.repos.d/
2.3.2安装MySQL服务(这个过程可能有点慢)
yum -y install mysql-server
出现以下错误
解决办法如下:
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
2.4启动MySQL
systemctl start mysqld
3.修改MySQL临时密码
MySQL安装成功后会有一个临时密码,我们可以使用
grep
命令查看临时密码先登录进去MySQL,然后修改MySQL密码
3.1获取MySQL临时密码
grep 'temporary password' /var/log/mysqld.log
3.2使用临时密码先登录
mysql -uroot -p
我的临时密码是:a22XRJ88=+a;
3.3把MySQL的密码校验强度改为低风险
set global validate_password_policy=LOW;
3.4修改MySQL的密码长度
set global validate_password_length=5;
3.5修改MySQL密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'admin';
4.允许远程访问
4.1首先要关闭Cenots的防火墙
sudo systemctl disable firewalld
4.2修改MySQL允许任何人连接
4.2.1首先登录MySQL
mysql -uroot -padmin
4.2.2切换到mysql数据
use mysql;
4.2.3查看user表
select Host,User from user;
发现root
用户只允许localhost
主机登录登录
4.2.4修改为允许任何地址访问
update user set Host='%' where User='root';
4.2.5刷新权限
flush privileges;
5.使用Navicat连接工具测试
(1)查看主机号
(2)连接
(3)连接成功
注意:如果连接未成功就是你的远程访问设置失败
边栏推荐
- 牛血清白蛋白-葡聚糖-叶黄素纳米颗粒/半乳糖白蛋白磁性阿霉素纳米粒的制备
- LeetCode·每日一题·1374.生成每种字符都是奇数个的字符串·模拟
- How to make the timer not execute when the page is minimized?
- LeetCode·32.最长有效括号·栈·动态规划
- LeetCode
- Appendix A printf, varargs and stdarg A.1 printf family of functions
- Scala练习题+答案
- 关于npm的那些事儿
- 基于php湘西旅游网站管理系统获取(php毕业设计)
- 左旋氧氟沙星/载纳米雄黄磁性/As2O3磁性Fe3O4/三氧化二砷白蛋白纳米球
猜你喜欢
对C语言结构体内存对齐的理解
WEB 渗透之文件类操作
ISC2022 HackingClub white hat summit countdown 1 day!Most comprehensive agenda formally announced!Yuan universe, wonderful!
ISC2022 HackingClub白帽峰会倒计时1天!最全议程正式公布!元宇宙集结,精彩绝伦!
ModuleNotFoundError: No module named ‘yaml‘
LeetCode
一个关于操作数据库的建议—用户密码
Anacoda的用途
The difference between groupByKey and reduceBykey
365天挑战LeetCode1000题——Day 046 生成每种字符都是奇数个的字符串 + 两数相加 + 有效的括号
随机推荐
空间数据库开源路,超图+openGauss风起禹贡
ISC2022 HackingClub white hat summit countdown 1 day!Most comprehensive agenda formally announced!Yuan universe, wonderful!
【力扣】字符串相乘
C Expert Programming Chapter 1 C: Through the Fog of Time and Space 1.1 The Prehistoric Phase of the C Language
方舟生存进化是什么游戏?好不好玩
基于php旅游网站管理系统获取(php毕业设计)
Day33 LeetCode
C pitfalls and pitfalls Chapter 8 Suggestions and answers 8.2 Answers
Spark集群搭建
shell programming conventions and variables
Jmeter combat | Repeated and concurrently grabbing red envelopes with the same user
C Expert Programming Chapter 1 C: Through the Fog of Time and Space 1.5 ANSI C Today
shell编程规范与变量
网络水军第一课:手写自动弹幕
How to make the timer not execute when the page is minimized?
The Microsoft campus ambassador to shout you to autumn recruit!
Based on php film and television information website management system acquisition (php graduation design)
How to encapsulate the cookie/localStorage sessionStorage hook?
虚拟内存与物理内存之间的关系
Mini Program--Independent Subcontracting & Subcontracting Pre-download