CentOS7.4下MySQL5.7.28的RPM方式安装
发表于:2025-11-07 作者:千家信息网编辑
千家信息网最后更新 2025年11月07日,Linux系统版本:CentOS7.4MySQL版本:5.7.28在Linux平台有RPM包、二进制包、源码包3中安装方式,这一篇文章主要是以RPM包为例来介绍如何在Linux平台下进行MySQL的安
千家信息网最后更新 2025年11月07日CentOS7.4下MySQL5.7.28的RPM方式安装
Linux系统版本:CentOS7.4
MySQL版本:5.7.28
在Linux平台有RPM包、二进制包、源码包3中安装方式,这一篇文章主要是以RPM包为例来介绍如何在Linux平台下进行MySQL的安装。
下载地址:
https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar
安装RPM包的具体操作步骤如下:
(1)首先卸载mariadb,不然后面会和安装mysql需要的库冲突:
[root@localhost ~]# rpm -qa | grep mariadbmariadb-libs-5.5.56-2.el7.x86_64[root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64(2)切换到root下(只有root才可以执行RPM包):
[sunan@localhost ~]$ su - rootPassword:Last login: Mon Oct 28 20:12:16 CST 2019 from 192.168.1.19 on pts/0(3)解压缩安装包:
[root@localhost opt]# tar -xvf mysql-5.7.28-1.el7.x86_64.rpm-bundle.tarmysql-community-embedded-5.7.28-1.el7.x86_64.rpmmysql-community-libs-compat-5.7.28-1.el7.x86_64.rpmmysql-community-devel-5.7.28-1.el7.x86_64.rpmmysql-community-embedded-compat-5.7.28-1.el7.x86_64.rpmmysql-community-libs-5.7.28-1.el7.x86_64.rpmmysql-community-test-5.7.28-1.el7.x86_64.rpmmysql-community-common-5.7.28-1.el7.x86_64.rpmmysql-community-embedded-devel-5.7.28-1.el7.x86_64.rpmmysql-community-client-5.7.28-1.el7.x86_64.rpmmysql-community-server-5.7.28-1.el7.x86_64.rpm(4)安装解压缩的包,这些包不需要全部安装,但要注意安装顺序,有相互依赖:
[root@localhost opt]# rpm -ivh mysql-community-common-5.7.28-1.el7.x86_64.rpmwarning: mysql-community-common-5.7.28-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ################################# [100%]Updating / installing... 1:mysql-community-common-5.7.28-1.e################################# [100%][root@localhost opt]# rpm -ivh mysql-community-libs-5.7.28-1.el7.x86_64.rpmwarning: mysql-community-libs-5.7.28-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ################################# [100%]Updating / installing... 1:mysql-community-libs-5.7.28-1.el7################################# [100%][root@localhost opt]# rpm -ivh mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpmwarning: mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ################################# [100%]Updating / installing... 1:mysql-community-libs-compat-5.7.2################################# [100%][root@localhost opt]# rpm -ivh mysql-community-client-5.7.28-1.el7.x86_64.rpmwarning: mysql-community-client-5.7.28-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ################################# [100%]Updating / installing... 1:mysql-community-client-5.7.28-1.e################################# [100%][root@localhost opt]# rpm -ivh mysql-community-server-5.7.28-1.el7.x86_64.rpmwarning: mysql-community-server-5.7.28-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ################################# [100%]Updating / installing... 1:mysql-community-server-5.7.28-1.e################################# [100%][root@localhost opt]# rpm -ivh mysql-community-devel-5.7.28-1.el7.x86_64.rpmwarning: mysql-community-devel-5.7.28-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ################################# [100%]Updating / installing... 1:mysql-community-devel-5.7.28-1.el################################# [100%](5)安装完成,数据库初始化:
[root@localhost ~]# mysqld --initialize --user=mysql(6)初始化完成,生成一个临时的数据库root密码:
[root@localhost ~]# cat /var/log/mysqld.log2019-10-28T13:59:16.673149Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2019-10-28T13:59:17.569975Z 0 [Warning] InnoDB: New log files created, LSN=457902019-10-28T13:59:17.639527Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.2019-10-28T13:59:17.701489Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 21f571cf-f98b-11e9-add4-000c29eb2c51.2019-10-28T13:59:17.705734Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.2019-10-28T13:59:18.493027Z 0 [Warning] CA certificate ca.pem is self signed.2019-10-28T13:59:18.708430Z 1 [Note] A temporary password is generated for root@localhost: )DrGVQo+s6-s(7)启动MySQL:
[root@localhost ~]# systemctl start mysqld.service[root@localhost ~]# systemctl status mysqld.service● mysqld.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2019-10-28 22:05:55 CST; 24s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 1599 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS) Process: 1582 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS) Main PID: 1603 (mysqld) CGroup: /system.slice/mysqld.service └─1603 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pidOct 28 22:05:55 localhost.localdomain systemd[1]: Starting MySQL Server...Oct 28 22:05:55 localhost.localdomain systemd[1]: Started MySQL Server.(8)登录MySQL数据库,并设置新的密码:
[root@localhost ~]# mysql -uroot -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.7.28Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> set password = password('输入新的密码');Query OK, 0 rows affected, 1 warning (0.00 sec)
密码
数据
数据库
平台
版本
方式
二进制
只有
地址
步骤
源码
篇文章
系统
顺序
中安
冲突
切换
生成
登录
输入
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
我的世界酷爱zero服务器对决
数据库检查约束日期
职业网络技术英语单词
北京智慧团建软件开发专业制作
即时通讯服务器搭建
财富管理软件开发团队
软件开发安全法律法规
方舟手机能不能开服务器
怎么自己装一台服务器
错误请求服务器找不到是什么缘故
e7管理系统显示消息服务器错误
小班网络安全宣传视频
网络安全 教育局
cms管理服务器
计算机网络技术英文介绍
新形势下网络安全意识
网络安全课程实践活动
vue的组件存放数据库
数据库表格个别数据不输入
软件开发最多的城市
深圳松之峰网络技术有限公司
龙海手机软件开发
浪潮服务器能用普通显卡么
软件开发 工资怎么发 避税
联想服务器管理口怎么进
数据库原理章节试题
宁夏兴庆区软件开发公司
VB数据库查询代码
暗黑修仙数据库修改
华为电脑服务器