当前位置:网站首页>CentOS7 —— yum安装mysql
CentOS7 —— yum安装mysql
2022-08-04 05:24:00 【小东西的东西】
先检查系统是否安装有mysql
1
2
[[email protected] ~]#yum list installed mysql*
[[email protected] ~]#rpm –qa|grep mysql*
2、查看有没有安装包
[[email protected] ~]#yum list mysql*
3、安装mysql客户端
[[email protected] ~]#yum install mysql

注意看,这里默认安装的是mariab
4、安装mysql服务端(提示)
提示:如果输入此命令没有报错,则跳过下面步骤,继续安装下一个服务端
[[email protected] ~]#yum install mysql-server

注意:此处错误提示为Mysql安装失败,安装的是MariaDB
原因:CentOS7自带有MariaDB而不是MySQL,MariaDB和MySQL一样也是开元的数据库
5、安装mysql服务端(处理方式)下载MySQL源安装包
去官网查看最新安装包
https://dev.mysql.com/downloads/repo/yum/


复制这个下载地址,使用wget来下载到linux。
如果没安装 wget工具 ,用 yum -y installwget 安装一下先。

用wget + 下载地址 来下载到Linux本地 ,然后用yum来安装。



查看一下安装效果
yum repolist enabled | grep mysql.*

安装MySQL服务器
yum -y install mysql-community-server

启动MySQL服务
systemctl start mysqld.service
运行一下命令查看一下运行状态
systemctl status mysqld.service

初始化数据库密码
查看一下初始密码
grep “password” /var/log/mysqld.log

直接复制输入密码错误
原因是!属于特殊字符,要加 转义,写成! 才能成功识别。
登录
mysql -uroot -p
修改密码
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘****************’;
mysql默认安装了密码安全检查插件(validate_password),默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位。
否则会提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements错误

六:数据库授权
数据库没有授权,只支持localhost本地访问
mysql>GRANT ALL PRIVILEGES ON *.* TO?``'root'``@``'%'``IDENTIFIED BY?``'123456'``WITH GRANT OPTION;
//``远程连接数据库的时候需要输入用户名和密码
用户名:root
密码:123456
指点ip:%代表所有Ip,此处也可以输入Ip来指定Ip
输入后使修改生效还需要下面的语句
mysql>FLUSH PRIVILEGES;
也可以通过修改表来实现远程:
mysql -u root -p
mysql> use mysql;
mysql> update user set host = '%' where user = 'root';
mysql> select host, user from user;
七:设置自动启动
systemctl enable mysqld
systemctl daemon-reload
8 防火墙设置
参考这个CentOS7下安装MySQL,修改端口 - BlackManZhang - 博客园
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- Towards Real-Time Multi-Object Tracking(JDE)
- 力扣:63. 不同路径 II
- npm报错Beginning October 4, 2021, all connections to the npm registry - including for package installa
- About yolo7 and gpu
- 8款最佳实践,保护你的 IaC 安全!
- 入坑软件测试的经验与建议
- 力扣:62.不同路径
- 触觉智能分享-SSD20X实现升级显示进度条
- OpenSSF 安全计划:SBOM 将驱动软件供应链安全
- Tactile intelligent sharing - SSD20X realizes upgrade display progress bar
猜你喜欢

How to simplify the automation of modern e-procurement?

npm安装依赖报错npm ERR! code ENOTFOUNDnpm ERR! syscall getaddrinfonpm ERR! errno ENOTFOUND

Programming hodgepodge (4)

Shocked, 99.9% of the students didn't really understand the immutability of strings

编程大杂烩(四)

数的划分之动态规划

px、em、rem的区别

Tactile intelligent sharing - SSD20X realizes upgrade display progress bar

符号表
![[21 Days Learning Challenge] Image rotation problem (two-dimensional array)](/img/51/fb78f36c71e1eaac665ce9f1ce04ea.png)
[21 Days Learning Challenge] Image rotation problem (two-dimensional array)
随机推荐
Resolved error: npm WARN config global `--global`, `--local` are deprecated
share总结
8款最佳实践,保护你的 IaC 安全!
C专家编程 第4章 令人震惊的事实:数组和指针并不相同 4.5 数组和指针的其他区别
应届生软件测试薪资大概多少?
Performance testing with Loadrunner
[Cocos] cc.sys.browserType可能的属性
某母婴小程序加密参数解密
《看见新力量》第四期免费下载!走进十五位科技创业者的精彩故事
Do you think border-radius is just rounded corners?【Various angles】
你以为border-radius只是圆角吗?【各种角度】
Turn: Management is the love of possibility, and managers must have the courage to break into the unknown
解决错误:npm WARN config global `--global`, `--local` are deprecated
3面头条,花7天整理了面试题和学习笔记,已正式入职半个月
C Expert Programming Chapter 4 The Shocking Fact: Arrays and pointers are not the same 4.2 Why does my code not work
FPGA学习笔记——知识点总结
Jenkins export and import Job Pipeline
C专家编程 第4章 令人震惊的事实:数组和指针并不相同 4.4 使声明与定义相匹配
高性能高可靠性高扩展性分布式防火墙架构
[Skill] Using Sentinel to achieve priority processing of requests