【MySQL yum安装】【yum安装存放文件的位置】【编译mysql安装存文件位置】【解决mysql安装完成没有密码】【mysq修改密码 方法】【修改mysql密码强度】

【MySQL yum安装】

- #### yum 安装

在这里插入图片描述

步骤: 关闭防火墙
systemctl stop firewalld
setenforce 0

  • 优点:操作简单易用。不用单独下载,服务器可以联网且yum源没有问题即可(可以选择国内的163/阿里源)

步骤:官网下载mysql 安装包

wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

  • 在这里插入图片描述

  • [root@192 yum.repos.d]# rpm -ivh mysql80-community-release-el7-3.noarch.rpm 解压安装包

在这里插入图片描述

步骤2:编写 mysql 配置文件下载5.7版本

[root@192 ~]# cd /etc/yum.repos.d/
[root@192 yum.repos.d]# vim mysql-community.repo
在这里插入图片描述

步骤:安装 下载

[root@192 yum.repos.d]# yum -y install mysql-community-server

查看mysql密码

grep password /var/log/mysqld.log yum安装密码都在这个目录下

yum安装存放文件的位置

#/var/lib/mysql #存放数据文件
#/usr/share/mysql #用于存放字符集,语言信息等
#/usr/bin/ #存放二进制命令
#/var/log/mysqld.log #错误日志文件存放

编译安装存文件位置

一般文件都是在你编译安装的存放目录以下
在这里插入图片描述

mysql安装完成没有密码

案例1:
如果首次启动,在日志文件中没有产生密码,进行以下操作
#systemctl stop mysqld 先停止mysql
#rm - rf /var/lib/mysql/* 删除这个日志目录下的东西,从新生成
#systemctl start mysqld 密码就会重新生成

mysq修改密码 方法

两种方式:
第一种:
[root ~]# mysql -uroot -p’woHtkMgau9,w’ #登录
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.27

mysql> alter user ‘root’@‘localhost’ identified by ‘QianFeng@123’; 修改方法
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges; //刷新权限表
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
[root ~]# mysql -uroot -p’QianFeng@123’ 新密码登录
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.27 MySQL Community Server (GPL)

mysql> exit
Bye

第二种:
#mysqladmin -u root -p’旧密码’ password ‘新密码’
注:修改密码必须大小写数字和特殊符号都有。
第三种:
在这里插入图片描述

修改mysql密码强度 企业不用

步骤:
[root@mysql-server ~]# vim /etc/my.cnf #在最后添加如下内容
validate_password=off 固定语法
[root@mysql-server ~]# systemctl restart mysqld #重启mysql生效
可以用第二种方式修改为简单的密码:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值