MySQL使用rpm包安装

MySQL使用rpm包安装

安装

  1. 下载mysql rpm 安装包 。选择对应的操作系统版本 官网地址 下载对应的rpm包
mysql-community-common-5.7.29-1.el7.x86_64.rpm
mysql-community-libs-5.7.29-1.el7.x86_64.rpm
mysql-community-client-5.7.29-1.el7.x86_64.rpm
mysql-community-server-5.7.29-1.el7.x86_64.rpm
  1. 依次执行下面命令
rpm -ivh mysql-community-common-5.7.29-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.29-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.29-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.29-1.el7.x86_64.rpm

报错

➜  tools rpm -ivh mysql-community-libs-5.7.29-1.el7.x86_64.rpm
warning: mysql-community-libs-5.7.29-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
        mysql-community-common(x86-64) >= 5.7.9 is needed by mysql-community-libs-5.7.29-1.el7.x86_64
        mariadb-libs is obsoleted by mysql-community-libs-5.7.29-1.el7.x86_64
➜  tools rpm -qa | grep mariadb
mariadb-libs-5.5.68-1.el7.x86_64
➜  tools  rpm -e mariadb-libs-5.5.68-1.el7.x86_64
error: Failed dependencies:
        libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-9.el7.x86_64
        libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-9.el7.x86_64
➜  tools  rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64
  1. 关于卸载
rpm -qa|grep mysql
rpm -e mysql-community-server-5.7.29-1.el7.x86_64.rpm
rpm -e mysql-community-client-5.7.29-1.el7.x86_64.rpm
rpm -e mysql-community-libs-5.7.29-1.el7.x86_64.rpm
rpm -e mysql-community-common-5.7.29-1.el7.x86_64.rpm

使用

  1. systemctl start mysqld 启动mysql
  2. grep password /var/log/mysqld.log 查看密码
  3. 登录mysql
  4. 修改密码
➜  tools grep password /var/log/mysqld.log
2022-09-18T04:02:24.435856Z 1 [Note] A temporary password is generated for root@localhost: YeBPgBelw3_O
➜  tools mysql -uroot -PYeBPgBelw3_O
mysql: [ERROR] Unknown suffix 'Y' used for variable 'port' (value 'YeBPgBelw3_O')
mysql: [ERROR] mysql: Error while setting value 'YeBPgBelw3_O' to 'port'
➜  tools mysql -uroot -p YeBPgBelw3_O
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
➜  tools mysql -uroot -pYeBPgBelw3_O
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.29

Copyright (c) 2000, 2020, 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>
  1. 修改密码

在5.7版本不太友好,密码要求比较严格
如果你想要设置一个简单的测试密码的话,比如设置为root,会提示这个错误,报错的意思就是你的密码不符合要求
警告:由于密码将以明文形式发送到服务器,请使用ssl连接以确保密码安全。

➜  tools mysqladmin -u root -p password "xxxxx"
Enter password:
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
mysqladmin: unable to change password; error: 'Your password does not satisfy the current policy requirements'

修改设置密码的策略

➜  tools mysql -uroot -pYeBPgBelw3_O
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 10
Server version: 5.7.29

Copyright (c) 2000, 2020, 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>  set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)

mysql>  set global validate_password_length=1;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

再次设置密码成功

➜  tools mysqladmin -u root -p password "xxxxx"
Enter password:   #输入原始密码
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Erice_s

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值