linux系统安装rpm包数据库详细步骤
Posted 咸鱼加辣
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux系统安装rpm包数据库详细步骤相关的知识,希望对你有一定的参考价值。
准备材料
1、rpm包
2、linux虚拟机
解压bundler安装包命令
tar -xvf mysql-8.0.27-1.el7.x86_64.rpm-bundle.tar。
解压包后生成文件
rpm -ivh mysql-community-common-8.0.27-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.27-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.27-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.27-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.27-1.el7.x
如果报错
[root@localhost mysql]# rpm -ivh mysql-community-libs-8.0.27-1.el7.x86_64.rpm
warning: mysql-community-libs-8.0.27-1.el7.x86_64.rpm: Header V3 DSA/SHA256 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
mariadb-libs is obsoleted by mysql-community-libs-8.0.27-1.el7.x86_64
执行以下命令,排查错误
[root@localhost mysql]# yum remove mysql-libs
然后再重新安装即可。
[root@localhost mysql]# rpm -qa | grep -i mysql
mysql-community-server-8.0.27-1.el7.x86_64
mysql-community-client-plugins-8.0.27-1.el7.x86_64
mysql-community-libs-8.0.27-1.el7.x86_64
mysql-community-client-8.0.27-1.el7.x86_64
mysql-community-common-8.0.27-1.el7.x86_64
查询mysql状态
[root@localhost mysql]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
[root@localhost mysql]# systemctl start mysqld
开启mysql
root@localhost mysql]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2022-07-19 00:20:34 PDT; 2s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 6221 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 6302 (mysqld)
Status: "Server is operational"
Tasks: 38
CGroup: /system.slice/mysqld.service
└─6302 /usr/sbin/mysqld
Jul 19 00:20:21 localhost.localdomain systemd[1]: Starting MySQL Server...
Jul 19 00:20:34 localhost.localdomain systemd[1]: Started MySQL Server.
查找临时密码
[root@localhost mysql]# grep "temporary password" /var/log/mysqld.log
2022-07-19T07:20:26.212621Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: EhnFd0aysV=K
登录并且更改临时密码
[root@localhost mysql]# mysql -uroot -p
Enter password:
mysql> alter user 'root'@'localhost' identified by '123456';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> alter user 'root'@'localhost' identified by '123.aA456';
Query OK, 0 rows affected (0.07 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select host, user from user;
+-----------+------------------+
| host | user |
+-----------+------------------+
| localhost | mysql.infoschema |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+-----------+------------------+
4 rows in set (0.00 sec)
mysql> update user set host = '%' where user = 'root';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select host, user from user;
+-----------+------------------+
| host | user |
+-----------+------------------+
| % | root |
| localhost | mysql.infoschema |
| localhost | mysql.session |
| localhost | mysql.sys |
+-----------+------------------+
4 rows in set (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
以上是关于linux系统安装rpm包数据库详细步骤的主要内容,如果未能解决你的问题,请参考以下文章