centos7 RPM方式安装MySQL5.7

centos7 RPM方式安装MySQL5.7

1、下载Linux对应的RPM包,CentOS7对应的RPM包,如下:

[[email protected] soft]# unzip mysql-5.7-centos7.zip 
Archive:  mysql-5.7-centos7.zip
 extracting: mysql-commercial-client-5.7.16-1.1.el7.x86_64.rpm  
 extracting: mysql-commercial-embedded-5.7.16-1.1.el7.x86_64.rpm  
 extracting: mysql-commercial-common-5.7.16-1.1.el7.x86_64.rpm  
 extracting: mysql-commercial-libs-compat-5.7.16-1.1.el7.x86_64.rpm  
 extracting: mysql-commercial-embedded-compat-5.7.16-1.1.el7.x86_64.rpm  
 extracting: mysql-commercial-devel-5.7.16-1.1.el7.x86_64.rpm  
 extracting: mysql-commercial-server-5.7.16-1.1.el7.x86_64.rpm  
 extracting: mysql-commercial-test-5.7.16-1.1.el7.x86_64.rpm  
 extracting: mysql-commercial-embedded-devel-5.7.16-1.1.el7.x86_64.rpm  
 extracting: mysql-commercial-libs-5.7.16-1.1.el7.x86_64.rpm  
 extracting: README.txt

2、检查MySQL及相关RPM包,是否安装,如果有安装,则移除(rpm –e 名称)

[[email protected] soft]#rpm -qa | grep -i mariadb-*
[[email protected] soft]# rpm -e  mariadb-libs
否则有可能报错:
[[email protected] soft]# rpm -ivh  mysql-commercial-libs-5.7.16-1.1.el7.x86_64.rpm 
warning: mysql-commercial-libs-5.7.16-1.1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
mysql-commercial-common(x86-64) >= 5.7.9 is needed by mysql-commercial-libs-5.7.16-1.1.el7.x86_64
mariadb-libs is obsoleted by mysql-commercial-libs-5.7.16-1.1.el7.x86_64

3、安装MySQL,安装有顺序

[[email protected] soft]# rpm -ivh  mysql-commercial-common-5.7.16-1.1.el7.x86_64.rpm
warning: mysql-commercial-common-5.7.16-1.1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-commercial-common-5.7.16-1.################################# [100%]
[[email protected] soft]# rpm -ivh --force mysql-commercial-libs-5.7.16-1.1.el7.x86_64.rpm 
warning: mysql-commercial-libs-5.7.16-1.1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-commercial-libs-5.7.16-1.1.################################# [100%]
[[email protected] soft]# rpm -ivh  mysql-commercial-client-5.7.16-1.1.el7.x86_64.rpm
warning: mysql-commercial-client-5.7.16-1.1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-commercial-client-5.7.16-1.################################# [100%]
测试预安装提示如下:
[[email protected] soft]# rpm -ivh --test mysql-commercial-server-5.7.16-1.1.el7.x86_64.rpm
warning: mysql-commercial-server-5.7.16-1.1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
net-tools is needed by mysql-commercial-server-5.7.16-1.1.el7.x86_64
注:需要依赖net-tools组件
[[email protected] soft]# yum install net-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * epel: mirror01.idc.hinet.net
 * extras: centos.ustc.edu.cn
 * updates: centos.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.17.20131004git.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================
 Package                     Arch                     Version                                    Repository              Size
==============================================================================================================================
Installing:
 net-tools                   x86_64                   2.0-0.17.20131004git.el7                   base                   304 k
Transaction Summary
==============================================================================================================================
Install  1 Package
Total download size: 304 k
Installed size: 917 k
Is this ok [y/d/N]: y
Downloading packages:
net-tools-2.0-0.17.20131004git.el7.x86_64.rpm                                                          | 304 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 2 pre-existing rpmdb problem(s), ‘yum check‘ output follows:
2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18()(64bit)
2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18(libmysqlclient_18)(64bit)
  Installing : net-tools-2.0-0.17.20131004git.el7.x86_64                                                                  1/1 
  Verifying  : net-tools-2.0-0.17.20131004git.el7.x86_64                                                                  1/1 
Installed:
  net-tools.x86_64 0:2.0-0.17.20131004git.el7                                                                                 
Complete!
[[email protected] soft]# rpm -ivh --test mysql-commercial-server-5.7.16-1.1.el7.x86_64.rpm
warning: mysql-commercial-server-5.7.16-1.1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
[[email protected] soft]# rpm -ivh mysql-commercial-server-5.7.16-1.1.el7.x86_64.rpm
warning: mysql-commercial-server-5.7.16-1.1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-commercial-server-5.7.16-1.################################# [100%]

4、备份my.cnf,重新初始化数据库,注意mysql5.7版本初始化会随机生成一个root登录的随机密码

[[email protected] sbin]#cp /etc/my.cnf /etc/my.cnf.bak
[[email protected] sbin]# /usr/sbin/mysqld --initialize --user=mysql --basedir=/data --datadir=/data 
2016-11-18T05:49:59.052988Z 1 [Note] A temporary password is generated for [email protected]: T=_GTj2Wroxm (root本地登录随机密码)

5、启动服务,修改root密码

[[email protected] sbin]# systemctl start  mysqld.service
mysql> alter user ‘root‘@‘localhost‘ identified by ‘12345678‘;
Query OK, 0 rows affected (0.00 sec)

6、安装后目录位置和内容

MySQL安装后涉及的目录如下:

目录目录中的内容

/usr/bin客户端程序和脚本

/usr/sbinMysqld服务器

/var/lib/mysql数据库的日志文件

/usr/share/info信息格式手册

/usr/share/manUnix 手册页

/usr/include/mysql包括 (标题) 的文件

/usr/lib/mysqlmysql的lib包

/usr/share/mysql杂项的支持文件,包括错误消息) 字符设置的文件,示例配置文件,SQL 数据库安装

/usr/share/sql-bench基准

默认字符集为:utf8_general_ci

mysql> show variables like ‘%collation%‘;
+----------------------+-------------------+
| Variable_name        | Value             |
+----------------------+-------------------+
| collation_connection | utf8_general_ci   |
| collation_database   | latin1_swedish_ci |
| collation_server     | latin1_swedish_ci |
+----------------------+-------------------+
3 rows in set (0.01 sec)
时间: 2024-10-13 16:15:54

centos7 RPM方式安装MySQL5.7的相关文章

centos7和centos6.5环境rpm方式安装mysql5.7和mysql5.6详解

centos7和centos6.5环境rpm方式安装mysql5.7和mysql5.6详解 centos环境安装mysql5.7 其实不建议安装mysql5.7 语法和配置可能和以前的版本区别较大,多坑,慎入 1.yum方式安装(不推荐) a.安装mysql5.7 yum源 centos6: wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpmyum localinstall mysql-community-release

无外网情况下RPM方式安装MySQL5.6

RPM方式安装MySQL5.6 a. 检查MySQL及相关RPM包,是否安装,如果有安装,则移除(rpm –e 名称) 1 [[email protected] ~]# rpm -qa | grep -i mysql 2 mysql-libs-5.1.66-2.el6_3.x86_64 3 [[email protected] ~]# yum -y remove mysql-libs* b. 下载Linux对应的RPM包,如:CentOS6.4_64对应的RPM包,如下:这里给出我下载好的包,官

CentOS 6.5 RPM方式安装MySQL5.6

转:http://www.juziku.com/wiki/13810.htm RPM方式安装MySQL5.6 a. 检查MySQL及相关RPM包,是否安装,如果有安装,则移除(rpm –e 名称) 1 [[email protected] ~]# rpm -qa | grep -i mysql 2 mysql-libs-5.1.66-2.el6_3.x86_64 3 [[email protected]host ~]# yum -y remove mysql-libs* b. 下载Linux对应

关于centos7中使用rpm方式安装mysql5.7版本后无法使用root登录的问题

最近在centos7中通过rpm方式安装了最新版本的mysql-server 5.7 (mysql57-community-release-el7-7.noarch.rpm) ,发现安装成功后无法使用root登录.百度google一番无果,最后在官方文档中找到了答案.现记录完整安装及问题解决过程,希望能帮助到其他朋友. OS版本: Linux version 3.10.0-327.el7.x86_64 ([email protected]) (gcc version 4.8.3 20140911

记一次 centos7.2 rpm方式安装mysql5.7.19 报错

0.环境 本文操作系统: CentOS 7.2.1511 x86_64 MySQL 版本: 5.7.19 安装之前先把开发环境装一下 yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre* make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel glib2 glib2-d

CentOS下以RPM方式安装MySQL5.5

首先去mySQL官网下载页面: http://dev.mysql.com/downloads/mysql/#downloads Select Platform 选择  Oracle & Red Hat Linux 4 & 5 分别下载以下三个文件(由于我的机器是32位,下面是32位版本的包,如果你的机器是64位的请下载64位版本): 1. Red Hat & Oracle Linux 5 (x86, 32-bit), RPM Package MySQL Server 2. Red

MySQL之——CentOS下以RPM方式安装MySQL5.5

转载请注明出处:http://blog.csdn.net/l1028386804/article/details/46507735 首先去mySQL官网下载页面: http://dev.mysql.com/downloads/mysql/#downloads Select Platform 选择  Oracle & Red Hat Linux 4 & 5 分别下载以下三个文件(由于我的机器是32位,下面是32位版本的包,如果你的机器是64位的请下载64位版本): 1. Red Hat &a

CentOS/RHEL 6+ 下以RPM方式安装MySQL5.5

首先去http://dev.mysql.com/downloads/mysql/5.5.html#downloads站点下载: 分别下载以下三个文件(由于我的机器是32位,下面是32位版本的包,如果你的机器是64位的请下载64位版本): MySQL-server-5.5.16-1.rhel5.i386.rpm MySQL-client-5.5.16-1.rhel4.i386.rpm MySQL-devel-5.5.16-1.rhel4.i386.rpm 使用wget命令使用断点传输的方式将这三个

rpm方式安装mysql-5.7.11

1.rpm bundel包下载到 /usr/local/src中: [[email protected] src]# ls mysql-5.7.11-1.el6.x86_64.rpm-bundle.tar 2解压缩bundle包 [[email protected] src]# tar xf mysql-5.7.11-1.el6.x86_64.rpm-bundle.tar  [[email protected] src]# ls mysql-5.7.11-1.el6.x86_64.rpm-bun