当前位置:网站首页>CentOS7 —— yum安装mysql
CentOS7 —— yum安装mysql
2022-07-31 04:47:00 【jiey0407】
先检查系统是否安装有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开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- ERROR 2003 (HY000) Can't connect to MySQL server on 'localhost3306' (10061)Solution
- MySQL修改root账号密码
- 【R语言】【3】apply,tapply,lapply,sapply,mapply与par函数相关参数
- input输入框展示两位小数之precision
- The third is the code to achieve
- DVWA安装教程(懂你的不懂·详细)
- Visual studio shortcuts that improve efficiency, summary (updated from time to time)
- Solved (the latest version of selenium framework element positioning error) NameError: name 'By' is not defined
- Reinforcement learning: from entry to pit to shit
- Interview | Cheng Li, CTO of Alibaba: Cloud + open source together form a credible foundation for the digital world
猜你喜欢
两个地址池r2负责管地址池r1负责管dhcp中继
MySQL database must add, delete, search and modify operations (CRUD)
Sql解析转换之JSqlParse完整介绍
The Vue project connects to the MySQL database through node and implements addition, deletion, modification and query operations
C语言表白代码?
MySQL事务(transaction) (有这篇就足够了..)
三子棋的代码实现
ENSP,划分VLAN、静态路由,三层交换机综合配置
Unity URP渲染管线摄像机核心机制剖析
MySQL数据库备份
随机推荐
PCL calculates the point cloud coordinate maximum and its index
【py脚本】批量二值化处理图像
Go language study notes - dealing with timeout problems - Context usage | Go language from scratch
BUG消灭者!!实用调试技巧超全整理
MySQL数据库必会的增删查改操作(CRUD)
input输入框展示两位小数之precision
ERROR 2003 (HY000) Can't connect to MySQL server on 'localhost3306' (10061)
Basic knowledge of mysql (2)
centos7安装mysql5.7步骤(图解版)
MySQL database must add, delete, search and modify operations (CRUD)
VScode+ESP32快速安装ESP-IDF插件
MySQL事务(transaction) (有这篇就足够了..)
Explanation of
MySQL事务隔离级别详解
聚变云原生,赋能新里程 | 2022开放原子全球开源峰会云原生分论坛圆满召开
手把手实现图片预览插件(三)
30 Years of Open Source Community | 2022 Open Atom Global Open Source Summit 30 Years of Open Source Community Special Event Held Successfully
MySQL常见面试题汇总(建议收藏!!!)
ES 源码 API调用链路源码分析
The input input box displays the precision of two decimal places