mysql-5.7.17-1的rpm安装

下载rpm软件包(mysql-5.7.17-1)
下载地址:https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar

[root@mysql local]# wget https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar
--2021-04-06 11:29:49--  https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar
正在解析主机 cdn.mysql.com (cdn.mysql.com)... 23.3.109.33
正在连接 cdn.mysql.com (cdn.mysql.com)|23.3.109.33|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:584130560 (557M) [application/x-tar]
正在保存至: “mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar”
 
100%[============================================================>] 584,130,560 3.51MB/s 用时 2m 37s 
 
2021-04-06 11:32:28 (3.54 MB/s) - 已保存 “mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar” [584130560/584130560])

解压:mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar

[root@mysql local]# tar -xvf mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar 
mysql-community-embedded-compat-5.7.17-1.el7.x86_64.rpm
mysql-community-libs-5.7.17-1.el7.x86_64.rpm
mysql-community-common-5.7.17-1.el7.x86_64.rpm
mysql-community-devel-5.7.17-1.el7.x86_64.rpm
mysql-community-client-5.7.17-1.el7.x86_64.rpm
mysql-community-server-5.7.17-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.17-1.el7.x86_64.rpm
mysql-community-server-minimal-5.7.17-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.17-1.el7.x86_64.rpm
mysql-community-test-5.7.17-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.17-1.el7.x86_64.rpm
mysql-community-embedded-5.7.17-1.el7.x86_64.rpm
[root@mysql53 local]#

跳过依赖检测安装rpm包

[root@mysql local]# rpm -ivh mysql-community-*  --nodeps --force
警告:mysql-community-client-5.7.17-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-common-5.7.17-1.e################################# [  8%]
   2:mysql-community-libs-5.7.17-1.el7################################# [ 17%]
   3:mysql-community-client-5.7.17-1.e################################# [ 25%]
   4:mysql-community-server-5.7.17-1.e################################# [ 33%]
   5:mysql-community-devel-5.7.17-1.el################################# [ 42%]
   6:mysql-community-embedded-5.7.17-1################################# [ 50%]
   7:mysql-community-embedded-devel-5.################################# [ 58%]
   8:mysql-community-test-5.7.17-1.el7################################# [ 67%]
   9:mysql-community-libs-compat-5.7.1################################# [ 75%]
  10:mysql-community-embedded-compat-5################################# [ 83%]
  11:mysql-community-server-minimal-5.警告:/etc/my.cnf 已建立为 /etc/my.cnf.rpmnew 
################################# [ 92%]
  12:mysql-community-minimal-debuginfo################################# [100%]
[root@mysql local]#

启动mysqld服务,设置开机自启

[root@mysql local]# systemctl restart mysqld
[root@mysql local]# systemctl enable mysqld

获取mysql初始化密码

[root@mysql local]# grep password /var/log/mysqld.log
2021-04-06T03:42:17.802484Z 1 [Note] A temporary password is generated for root@localhost: /ySFeySD%5gr
[root@mysql local]#

登录mysqld程序,修改密码

[root@mysql local]# mysql -u root -p'/ySFeySD%5gr'
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 4
Server version: 5.7.17
 
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
 
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;                              #没有修改密码前无法对数据库进行操作
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> set global validate_password_policy=0;       #只验证长度
Query OK, 0 rows affected (0.00 sec)
 
 mysql> set global validate_password_length=5;      #修改密码长度,默认值是5个字符 
 Query OK, 0 rows affected (0.00 sec)
 
 mysql> set password=password('mysql');
 Query OK, 0 rows affected, 1 warning (0.00 sec)
 
 mysql> exit
 Bye

验证密码是否已修改成功

[root@mysql local]# mysql -u root -p'/ySFeySD%5gr'   #初始密码登录
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
 
[root@mysql local]# mysql -u root -p'mysql'      #修改后密码登录
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 6
Server version: 5.7.17 MySQL Community Server (GPL)
 
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
 
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
mysql> show databases;        #可以查看数据库
 +--------------------------------+
 | Database                       |
 +--------------------------------+
 | information_schema             |
 | mysql                          |
 | performance_schema             |
 | sys                            |
 +--------------------------------+
 4 rows in set (0.00 sec)
 
 mysql>
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值