三 卸载旧版本的MySql (没有的话,则跳过此步骤)
      1、查看旧版本MySql
      rpm -qa | grep mysql
      将会列出旧版本MySql的组件列表,如:
     
      我的电脑这里只显示一个,有可能会有多个。
      2、逐个删除掉旧的组件
      使用命令rpm -e --nodeps {-file-name}进行移除操作,移除的时候可能会有依赖,要注意一定的顺序。
     
      第一次没有删除成功是因为最后多了一个空格。
 
四 使用 rpm 命令安装MySql组件
    使用命令rpm -ivh {-file-name}进行安装操作。
按照依赖关系依次安装rpm包 依赖关系依次为common→libs→client→server
rpm -ivh mysql-community-common-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.22-1.el7.x86_64.rpm
注:ivh中, i-install安装;v-verbose进度条;h-hash哈希校验
在安装 mysql-community-libs-5.7.22-1.el7.x86_64.rpm 时有可能会报错:mysql依赖错误
[root@nfs_client tools]# rpm -ivh mysql-community-libs-5.7.22-1.el7.x86_64.rpm
warning: mysql-community-libs-5.7.22-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.22-1.el7.x86_64
        mariadb-libs is obsoleted by mysql-community-libs-5.7.22-1.el7.x86_64
解决:清除yum里所有mysql依赖包
[root@nfs_client tools]# rpm -qa|grep mysql[root@nfs_client tools]# yum remove mysql-libs
清除完yum里所有mysql的依赖包后,再次安装mysql组件就不会报错了:
[root@nfs_client tools]# lsmysql-community-client-5.7.22-1.el7.x86_64.rpm  mysql-community-libs-5.7.22-1.el7.x86_64.rpmmysql-community-common-5.7.22-1.el7.x86_64.rpm  mysql-community-server-5.7.22-1.el7.x86_64.rpm[root@nfs_client tools]# rpm -ivh mysql-community-common-5.7.22-1.el7.x86_64.rpmwarning: mysql-community-common-5.7.22-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing...                          ################################# [100%]Updating / installing...   1:mysql-community-common-5.7.22-1.e################################# [100%][root@nfs_client tools]# rpm -ivh mysql-community-libs-5.7.22-1.el7.x86_64.rpmwarning: mysql-community-libs-5.7.22-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing...                          ################################# [100%]Updating / installing...   1:mysql-community-libs-5.7.22-1.el7################################# [100%][root@nfs_client tools]# rpm -ivh mysql-community-client-5.7.22-1.el7.x86_64.rpmwarning: mysql-community-client-5.7.22-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing...                          ################################# [100%]Updating / installing...   1:mysql-community-client-5.7.22-1.e################################# [100%][root@nfs_client tools]# rpm -ivh mysql-community-server-5.7.22-1.el7.x86_64.rpmwarning: mysql-community-server-5.7.22-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing...                          ################################# [100%]Updating / installing...   1:mysql-community-server-5.7.22-1.e################################# [100%][root@nfs_client tools]#
---------------------

数据库包下载:

https://www.mysql.com/downloads/

在GPL开原协议的社区开源版里边下载

我们用mysql community server里边的

其中workbench是客户端工具

MySQL Cluster是oracle自己搞的集群版的(集成了一些开源工具和增值服务)

选择操作系统和版本

建议在linux下安装

也可以选择版本

下载server包和client包

如果是server包,那架构图里的东西都有了

还要下个client utilities包,客户端包,类似connection层

下载后用rz命令传到centos linux系统里边

rpm是包管理器

xshell可以直接拖

也可以用rz命令,没有的话安装一下: yum install lrzsz

yum是包资源管理器,可以解决包依赖的问题,把需要的包都下载下来

传到linux系统

安装mysql步骤:

清理环境

centos7会自带一个mariadb

查看是否已安装

rpm -qa |grep -i mysql

rpm -qa |grep -i mariadb(centos7默认系统自带的)

mariadb是从mysql来的,是它的一个分支,需要清理掉

清理掉mariadb包

用yum直接安装你的话,用的mariadb的yum源,它跟mysql官方正式版不太一样,我们要安装官方正式版,就需要清掉mariadb,然后手动安装自己下载的官方正式版mysql

rpm -e 加上包名,把mariadb包清掉

可以看到用rpm删除会失败,提示有依赖关系的软件需要安装

rpm -e mariadb-libs-5.5.56-2.el7.x86_64

rpm删除时如果有依赖关系,可以用yum remove + 包名来删除mariadb

开始安装:

一般用装软件用yum直接安装也可以,但是有一个问题:用yum的话,是到默认的mariadb用的yum源去找,可能会找不到,所以我们自己来安装

rpm –ivh + 包安装所需要的包

rpm -ivh MySQL-client-5.6.42-1.el7.x86_64.rpm

rpm -ivh MySQL-server-5.6.42-1.el7.x86_64.rpm

server安装成功后会输出一些信息,如下:

[root@localhost soft]# rpm -ivh MySQL-server-5.6.42-1.el7.x86_64.rpm

warning: MySQL-server-5.6.42-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

1:MySQL-server-5.6.42-1.el7        ################################# [100%]

warning: user mysql does not exist - using root

warning: group mysql does not exist - using root

warning: user mysql does not exist - using root

warning: group mysql does not exist - using root

2018-11-18 13:53:24 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2018-11-18 13:53:24 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.

2018-11-18 13:53:24 0 [Note] /usr/sbin/mysqld (mysqld 5.6.42) starting as process 6420 ...

2018-11-18 13:53:24 6420 [Note] InnoDB: Using atomics to ref count buffer pool pages

2018-11-18 13:53:24 6420 [Note] InnoDB: The InnoDB memory heap is disabled

2018-11-18 13:53:24 6420 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2018-11-18 13:53:24 6420 [Note] InnoDB: Memory barrier is not used

2018-11-18 13:53:24 6420 [Note] InnoDB: Compressed tables use zlib 1.2.11

2018-11-18 13:53:24 6420 [Note] InnoDB: Using Linux native AIO

2018-11-18 13:53:24 6420 [Note] InnoDB: Using CPU crc32 instructions

2018-11-18 13:53:24 6420 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2018-11-18 13:53:24 6420 [Note] InnoDB: Completed initialization of buffer pool

2018-11-18 13:53:24 6420 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!

2018-11-18 13:53:24 6420 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB

2018-11-18 13:53:24 6420 [Note] InnoDB: Database physically writes the file full: wait...

2018-11-18 13:53:24 6420 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB

2018-11-18 13:53:25 6420 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB

2018-11-18 13:53:25 6420 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0

2018-11-18 13:53:25 6420 [Warning] InnoDB: New log files created, LSN=45781

2018-11-18 13:53:25 6420 [Note] InnoDB: Doublewrite buffer not found: creating new

2018-11-18 13:53:25 6420 [Note] InnoDB: Doublewrite buffer created

2018-11-18 13:53:25 6420 [Note] InnoDB: 128 rollback segment(s) are active.

2018-11-18 13:53:25 6420 [Warning] InnoDB: Creating foreign key constraint system tables.

2018-11-18 13:53:25 6420 [Note] InnoDB: Foreign key constraint system tables created

2018-11-18 13:53:25 6420 [Note] InnoDB: Creating tablespace and datafile system tables.

2018-11-18 13:53:25 6420 [Note] InnoDB: Tablespace and datafile system tables created.

2018-11-18 13:53:25 6420 [Note] InnoDB: Waiting for purge to start

2018-11-18 13:53:25 6420 [Note] InnoDB: 5.6.42 started; log sequence number 0

A random root password has been set. You will find it in '/root/.mysql_secret'.

2018-11-18 13:53:26 6420 [Note] Binlog end

2018-11-18 13:53:26 6420 [Note] InnoDB: FTS optimize thread exiting.

2018-11-18 13:53:26 6420 [Note] InnoDB: Starting shutdown...

2018-11-18 13:53:27 6420 [Note] InnoDB: Shutdown completed; log sequence number 1625977

2018-11-18 13:53:27 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2018-11-18 13:53:27 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.

2018-11-18 13:53:27 0 [Note] /usr/sbin/mysqld (mysqld 5.6.42) starting as process 6444 ...

2018-11-18 13:53:27 6444 [Note] InnoDB: Using atomics to ref count buffer pool pages

2018-11-18 13:53:27 6444 [Note] InnoDB: The InnoDB memory heap is disabled

2018-11-18 13:53:27 6444 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2018-11-18 13:53:27 6444 [Note] InnoDB: Memory barrier is not used

2018-11-18 13:53:27 6444 [Note] InnoDB: Compressed tables use zlib 1.2.11

2018-11-18 13:53:27 6444 [Note] InnoDB: Using Linux native AIO

2018-11-18 13:53:27 6444 [Note] InnoDB: Using CPU crc32 instructions

2018-11-18 13:53:27 6444 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2018-11-18 13:53:27 6444 [Note] InnoDB: Completed initialization of buffer pool

2018-11-18 13:53:27 6444 [Note] InnoDB: Highest supported file format is Barracuda.

2018-11-18 13:53:27 6444 [Note] InnoDB: 128 rollback segment(s) are active.

2018-11-18 13:53:27 6444 [Note] InnoDB: Waiting for purge to start

2018-11-18 13:53:27 6444 [Note] InnoDB: 5.6.42 started; log sequence number 1625977

2018-11-18 13:53:27 6444 [Note] Binlog end

2018-11-18 13:53:27 6444 [Note] InnoDB: FTS optimize thread exiting.

2018-11-18 13:53:27 6444 [Note] InnoDB: Starting shutdown...

2018-11-18 13:53:29 6444 [Note] InnoDB: Shutdown completed; log sequence number 1625987

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !

You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,

no other statement but 'SET PASSWORD' will be accepted.

See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

/usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.

This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

WARNING: Found existing config file /usr/my.cnf on the system.

Because this file might be in use, it was not replaced,

but was used in bootstrap (unless you used --defaults-file)

and when you later start the server.

The new default config file was created as /usr/my-new.cnf,

please compare it with your file and take the changes you need.

其中有两句指明mysql安装时给root设置了一个随机的初始密码:

密码的位置放在'/root/.mysql_secret'文件中

用于第一次登陆mysql时使用的,登陆之后会强制修改一下

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !

You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,

no other statement but 'SET PASSWORD' will be accepted.

See the manual for the semantics of the 'password expired' flag.

查看该文件,可以看到我在重装mysql时新生成一个随机密码

ps –ef|grep –i mysql 看是否有mysql进程

用rpm –qa |grep –I mysql看下mysql是否安装成功了,看到两个mysql的组件,就是安装成功了

5.6以后要设置一个root账号的随机密码

密码保存到root/.mysql_secret文件里

后边需要用这个初始的密码登录mysql

启动服务:service mysql start

ps –ef |grep mysql 看有没有mysql服务

登录数据库:

mysql –uroot –p 敲回车

然后输入随机密码

登录后,提示一些信息

如连接线程id、版本什么的

show databases; 查看数据库有哪些库

在使用前要设置一个自己的密码

会要求重置随机密码

重置密码方法:set password=password(‘root’);

是给当前用户设置密码为root

再运行 show databases;

mysql会自带一些系统库:

information_schema存一些统计数据

performance_schema存一些状态数据,

mysql存的数据用于监控、权限、账号等

test是测试库,用于做测试用的

如果重新安装,数据目录没变的话,那么之前的库还是存在的

linux 安装mysql(rpm文件安装)的更多相关文章

  1. CentOS 安装MySQL rpm方式安装

    MySQL源码方式安装:https://www.cnblogs.com/deverz/p/10997723.html 从最新版本的linux系统开始,默认的是 Mariadb而不是mysql!这里依旧 ...

  2. Linux下卸载和安装MySQL[rpm包]

    一.卸载原来的mysql: 卸载一: 输入: #rpm -qa | grep -i mysql 显示: mysql-libs-5.1.52-1.el6_0.1.i686 卸载方法: yum -y re ...

  3. linux安装mysql使用yum安装

    安装MySQL 安装mysql客户端: yum install mysql 安装mysql 服务器端: yum install mysql-server 至此我就可以使用Yum简单地管理MySQL更新 ...

  4. MySQL RPM二进制安装

    +++++++++++++++++++++++++++++++++++++++++++标题:MySQL RPM二进制安装时间:2019年2月24日内容:MySQL RPM二进制安装重点:MySQL R ...

  5. Linux下安装mysql(离线安装和在线安装)

    一:在线安装mysql 1.首先检测一下,mysql之前有没有被安装 命令:rpm -qa | grep mysql 2.删除mysql的命令: rpm -e --nodeps `rpm -qa | ...

  6. centos7 安装 mysql(在线安装)

    在CentOS中默认安装有MariaDB,这个是MySQL的分支,但为了需要,还是要在系统中安装MySQL,而且安装完成之后可以直接覆盖掉MariaDB. 1 下载并安装MySQL官方的 Yum Re ...

  7. 新服务器搭建-总结: 下载nginx,jdk8,docker-compose编排(安装mysql,redis) 附安装

    三明SEO: 前言 如题, 公司新买了一条4核16G的服务器, 不得不重新搭建环境, 只能一一重来, 做个记录 1.nginx : 手动安装 2.jdk8: 手动安装 3. 安装docker 及doc ...

  8. 在Windows上安装MySQL(免安装ZIP版)

    在 Windows 上安装MySQL(免安装ZIP版) 因为一些原因,重新安装了MySQL数据库,重装时习惯性使用最新版下载 此过程中发现MySQL 5.7.12 和MySQL 5.6的安装有些区别: ...

  9. linux下安装mysql(rpm文件安装)

    数据库包下载: https://www.mysql.com/downloads/ 在GPL开原协议的社区开源版里边下载 我们用mysql community server里边的 其中workbench ...

随机推荐

  1. Hive开启mapjoin优化、并行执行、动态分区

    1. mapjoin优化适合小表join大表 set hive.optimize.skewjoin=true; //有数据倾斜时开启负载均衡,默认false set hive.auto.convert ...

  2. django中同通过getlist() 接收页面form的post数组

    前端中的一些东西: <form action="people?action=edit" method="post"> <input type= ...

  3. Vue学习笔记十一:按键修饰符和自定义指令(钩子函数)

    目录 padStart:补位 按键修饰符 Vue提供的按键修饰符 自定义按键修饰符 自定义指令 自定义指令的使用 钩子函数 钩子函数参数 使用钩子函数的bingding参数 私有自定义指令 钩子函数的 ...

  4. iOS扩大按钮的点击范围

    // 重写此方法将按钮的点击范围扩大 - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { CGRect bounds = s ...

  5. 【Leetcode_easy】1047. Remove All Adjacent Duplicates In String

    problem 1047. Remove All Adjacent Duplicates In String 参考 1. Leetcode_easy_1047. Remove All Adjacent ...

  6. [BJOI2019] 删数 [dp转贪心结论+线段树]

    题面 传送门 思路 dp部分 以下称合法序列为原题面中可以删空的序列 这个是我在模拟考场上的思路 一开始我是觉得,这个首先可以写成一个dp的形式:$dp[i][j]$表示用$j$个数字填满了目标序列的 ...

  7. Java并发处理锁 Lock

    在上一篇文章中我们讲到了如何使用关键字synchronized来实现同步访问.本文我们继续来探讨这个问题,从Java 5之后,在 java.util.concurrent.locks 包下提供了另外一 ...

  8. python基础篇(四)

    PYTHON基础篇(四) 内置函数 A:基础数据相关(38) B:作用域相关(2) C:迭代器,生成器相关(3) D:反射相关(4) E:面向对象相关(9) F:其他(12) 匿名函数 A:匿名函数基 ...

  9. Spark直接读入fastq格式的数据

    输入文件: fastq格式 输出结果: kmer的频数和对应的kmer类型 系统环境Ubuntu单机版17.01 spark版本2.7 此次测试主要用到了RDD的函数foreach和zipWithIn ...

  10. mac upgrade node and npm

    一直以来, 我们都可以很轻松的更新npm: npm install npm -g 而Node我却是很久没有更新了, 记得当时好像是使用安装包安装的, 实际上有更加简单的安装方法. 实际上Mac上有一个 ...