MySQL使用rpm包安装
安装
- 下载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
- 依次执行下面命令
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
- 关于卸载
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
使用
- systemctl start mysqld 启动mysql
- grep password /var/log/mysqld.log 查看密码
- 登录mysql
- 修改密码
➜ 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>
- 修改密码
在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'
修改设置密码的策略文章来源:https://www.toymoban.com/news/detail-620972.html
➜ 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
再次设置密码成功文章来源地址https://www.toymoban.com/news/detail-620972.html
➜ 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.
到了这里,关于MySQL使用rpm包安装的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!