当前位置:网站首页>数据库系统原理与应用教程(005)—— yum 离线安装 MySQL5.7(Linux 环境)
数据库系统原理与应用教程(005)—— yum 离线安装 MySQL5.7(Linux 环境)
2022-07-01 16:14:00 【睿思达DBA_WGX】
数据库系统原理与应用教程(005)—— yum 离线安装 MySQL5.7(Linux 环境)
目录
一、卸载 MariaDB
[[email protected] Packages]# rpm -ivh lrzsz-0.12.20-36.el7.x86_64.rpm
警告:lrzsz-0.12.20-36.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:lrzsz-0.12.20-36.el7 ################################# [100%]
[[email protected] Packages]# yum remove -y mariadb-libs
已加载插件:fastestmirror
正在解决依赖关系
--> 正在检查事务
---> 软件包 mariadb-libs.x86_64.1.5.5.52-1.el7 将被 删除
--> 正在处理依赖关系 libmysqlclient.so.18()(64bit),它被软件包 2:postfix-2.10.1-6.el7.x86_64 需要
--> 正在处理依赖关系 libmysqlclient.so.18(libmysqlclient_18)(64bit),它被软件包 2:postfix-2.10.1-6.el7.x86_64 需要
--> 正在检查事务
---> 软件包 postfix.x86_64.2.2.10.1-6.el7 将被 删除
--> 解决依赖关系完成
依赖关系解决
===================================================================================================
Package 架构 版本 源 大小
===================================================================================================
正在删除:
mariadb-libs x86_64 1:5.5.52-1.el7 @anaconda 4.4 M
为依赖而移除:
postfix x86_64 2:2.10.1-6.el7 @anaconda 12 M
事务概要
====================================================================================================
移除 1 软件包 (+1 依赖软件包)
安装大小:17 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
正在删除 : 2:postfix-2.10.1-6.el7.x86_64 1/2
正在删除 : 1:mariadb-libs-5.5.52-1.el7.x86_64 2/2
验证中 : 2:postfix-2.10.1-6.el7.x86_64 1/2
验证中 : 1:mariadb-libs-5.5.52-1.el7.x86_64 2/2
删除:
mariadb-libs.x86_64 1:5.5.52-1.el7
作为依赖被删除:
postfix.x86_64 2:2.10.1-6.el7
完毕!
二、把所需的 rpm 包上传到服务器
[[email protected] mysql-soft]# pwd
/soft/mysql-soft
[[email protected] mysql-soft]# rz
[[email protected] mysql-soft]# ll
总用量 196704
-rw-r--r--. 1 root root 25365436 6月 12 2019 mysql-community-client-5.7.27-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 281248 6月 12 2019 mysql-community-common-5.7.27-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 2272032 6月 12 2019 mysql-community-libs-5.7.27-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 173500088 6月 12 2019 mysql-community-server-5.7.27-1.el7.x86_64.rpm
三、安装 rpm 包
[[email protected] mysql-soft]# rpm -ivh --nodeps --force *.rpm
警告:mysql-community-client-5.7.27-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-common-5.7.27-1.e################################# [ 25%]
2:mysql-community-libs-5.7.27-1.el7################################# [ 50%]
3:mysql-community-client-5.7.27-1.e################################# [ 75%]
4:mysql-community-server-5.7.27-1.e################################# [100%]
四、配置 MySQL 操作环境
1、启动 MySQL 服务
[[email protected] mysql-soft]# systemctl restart mysqld
2、查看 MySQL 相关的文件与目录
[[email protected] mysql-soft]# find / -name mysql*
/etc/selinux/targeted/active/modules/100/mysql
/etc/logrotate.d/mysql
/var/lib/mysql
/var/lib/mysql/mysql
/usr/bin/mysql
/usr/lib64/mysql
/usr/share/mysql
# MySQL 的配置文件
[[email protected] mysql-soft]# ll /etc/my.cnf
-rw-r--r--. 1 root root 960 6月 10 2019 /etc/my.cnf
# MySQL 的日志文件
[[email protected] mysql-soft]# ll /var/log/mysqld.log
-rw-r-----. 1 mysql mysql 3795 6月 26 19:14 /var/log/mysqld.log
# MySQL 的启动脚本
[[email protected] mysql-soft]# ll /usr/lib/systemd/system/mysqld.service
-rw-r--r--. 1 root root 1614 6月 10 2019 /usr/lib/systemd/system/mysqld.service
# MySQL 的进程文件
[[email protected] mysql-soft]# ll /var/run/mysqld/mysqld.pid
-rw-r-----. 1 mysql mysql 5 6月 26 19:14 /var/run/mysqld/mysqld.pid
# socket 文件
[[email protected] mysql-soft]# ll /var/lib/mysql/mysql.sock
srwxrwxrwx. 1 mysql mysql 0 6月 26 19:14 /var/lib/mysql/mysql.sock
3、查看 MySQL 默认的 root 账户密码
MySQL 安装完成之后,会为 root 账户 生成一个默认密码。通过下面的方式可以查看默认密码。
[[email protected] mysql-soft]# grep 'temporary password' /var/log/mysqld.log
2022-06-26T11:14:04.385266Z 1 [Note] A temporary password is generated for [email protected]: QFh7LiP8-r#c
4、使用默认密码登录 MySQL
[roo[email protected] mysql-soft]# mysql -uroot -pQFh7LiP8-r#c
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
Copyright (c) 2000, 2019, 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、修改 root 账号的密码
mysql> alter user 'root'@'localhost' identified by 'Wgx123456.';
Query OK, 0 rows affected (0.00 sec)
6、使用新密码登录 MySQL
[[email protected] mysql-soft]# mysql -uroot -pWgx123456.
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)
Copyright (c) 2000, 2019, 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>
边栏推荐
- Do280 management application deployment - pod scheduling control
- Please, stop painting star! This has nothing to do with patriotism!
- 从大湾区“1小时生活圈”看我国智慧交通建设
- 红队第8篇:盲猜包体对上传漏洞的艰难利用过程
- 运动捕捉系统原理
- Principle of motion capture system
- Golang爬虫框架初探
- Guide for high-end programmers to fish at work
- Uncover the "intelligence tax" of mousse: spend 4billion on marketing, and only 7 invention patents
- 2022 Moonriver global hacker song winning project list
猜你喜欢
Huawei issued hcsp-solution-5g security talent certification to help build 5g security talent ecosystem
She is the "HR of others" | ones character
Zhou Shaojian, rare
Is the programmer's career really short?
Where should older test / development programmers go? Will it be abandoned by the times?
Idea start command line is too long problem handling
【Hot100】19. 删除链表的倒数第 N 个结点
实现数字永生还有多久?元宇宙全息真人分身#8i
Tutorial on principles and applications of database system (004) -- MySQL installation and configuration: resetting MySQL login password (Windows Environment)
Tutorial on principles and applications of database system (006) -- compiling and installing MySQL 5.7 (Linux Environment)
随机推荐
[每日一氵]Latex 的通讯作者怎么搞
怎麼用MySQL語言進行行列裝置?
Problems encountered in IM instant messaging development to maintain heartbeat
How long will it take to achieve digital immortality? Metacosmic holographic human avatar 8i
如何使用phpIPAM来管理IP地址和子网
【php毕业设计】基于php+mysql+apache的教材管理系统设计与实现(毕业论文+程序源码)——教材管理系统
[daily news]what happened to the corresponding author of latex
SQLServer查询: a.id与b.id相同时,a.id对应的a.p在b.id对应的b.p里找不到的话,就显示出这个a.id和a.p
China's intelligent transportation construction from the perspective of "one hour life circle" in Dawan District
广东用电量大跌,说明高新技术产业替代高能耗产业已取得初步成果
[nodemon] app crashed - waiting for file changes before starting...解决方法
Can't global transactions be used when shardingjdbc is used in seate?
ThinkPHP kernel work order system source code commercial open source version multi user + multi customer service + SMS + email notification
程序员职业生涯真的很短吗?
从大湾区“1小时生活圈”看我国智慧交通建设
Comprehensively view the value of enterprise digital transformation
Go 语言怎么使用对称加密?
【SQL语句】请问这边为什么select出了两个上海,查询出了不同的count我想让他变成一个上海,count只显示一个总和
FPN网络详解
Telecommuting experience? Let's introduce ourselves ~ | community essay solicitation