银行 Rehat7无网部署Mysql.5.7

1.需求就不用讲了,客户现场,政府环境,银行环境,大多是没网的,所以无网安装是很有必要的

mysql下载路径:https://dev.mysql.com/downloads/mysql/

查看自己Linux系统版本


1

2


[[email protected] ~]# cat /etc/redhat-release

CentOS Linux release 7.3.1611 (Core)

往下拉继续选择

选择对应的下载,mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar

这样几分钟就下载了。

2.准备依赖包:

a.numactl 软件包:

  • numactl-2.0.9-6.el7_2.x86_64.rpm
  • numactl-devel-2.0.9-6.el7_2.x86_64.rpm
  • numactl-libs-2.0.9-6.el7_2.x86_64.rpm

b.其他相关支持:

  • perl-Data-Dumper-2.145-3.el7.x86_64.rpm
  • libaio-0.3.109-13.el7.x86_64.rpm

下载方式:https://pkgs.org

下面是下载路径:

libaio-0.3.109-13.el7.x86_64.rpm

perl-Data-Dumper-2.145-3.el7.x86_64.rpm

numactl-libs-2.0.9-6.el7_2.x86_64.rpm

numactl-devel-2.0.9-6.el7_2.x86_64.rpm

numactl-2.0.9-6.el7_2.x86_64.rpm

3.上传文件到服务器上


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20


localhost:Downloads lsl$ scp -r numactl-2.0.9-6.el7_2.x86_64.rpm 

[email protected]:/root/

[email protected]'s password:

numactl-2.0.9-6.el7_2.x86_64.rpm              100%   65KB   2.1MB/s   00:00   

localhost:Downloads kylin$ scp -r numactl-libs-2.0.9-6.el7_2.x86_64.rpm 

[email protected]:/root/

[email protected]'s password:

numactl-libs-2.0.9-6.el7_2.x86_64.rpm         100%   29KB   1.7MB/s   00:00   

localhost:Downloads kylin$ scp -r numactl-devel-2.0.9-6.el7_2.x86_64.rpm 

[email protected]:/root/

[email protected]'s password:

numactl-devel-2.0.9-6.el7_2.x86_64.rpm        100%   23KB   1.5MB/s   00:00   

localhost:Downloads kylin$ scp -r perl-Data-Dumper-2.145-3.el7.x86_64.rpm 

[email protected]:/root/

[email protected]'s password:

perl-Data-Dumper-2.145-3.el7.x86_64.rpm       100%   47KB   1.2MB/s   00:00   

localhost:Downloads kylin$ scp -r libaio-0.3.109-13.el7.x86_64.rpm 

[email protected]:/root/

[email protected]'s password:

Permission denied, please try again.

[email protected]'s password:

libaio-0.3.109-13.el7.x86_64.rpm              100%   24KB 618.3KB/s   00:00   

localhost:Downloads kylin$ scp -r mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar

[email protected]:/root/

[email protected]'s password:

mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar       100%  566MB   4.5MB/s   02:05

查看上传的包


1

2

3

4

5

6


[[email protected] ~]# ls

anaconda-ks.cfg                           numactl-devel-2.0.9-6.el7_2.x86_64.rpm

libaio-0.3.109-13.el7.x86_64.rpm          numactl-libs-2.0.9-6.el7_2.x86_64.rpm

miniconda2                                perl-Data-Dumper-2.145-3.el7.x86_64.rpm

mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar  pythonshell

numactl-2.0.9-6.el7_2.x86_64.rpm

4.安装

第一步,先安装依赖,安装 perl-Data-Dumper-2.145-3.el7.x86_64.rpm 和 libaio-0.3.109-13.el7.x86_64.rpm


1

2

3

4

5

6

7


[[email protected] ~]# rpm -ivh libaio-0.3.109-13.el7.x86_64.rpm

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

    package libaio-0.3.109-13.el7.x86_64 is already installed

[[email protected] ~]# rpm -ivh perl-Data-Dumper-2.145-3.el7.x86_64.rpm

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

Updating / installing...

   1:perl-Data-Dumper-2.145-3.el7     ################################# [100%]

第二步,继续安装 numactl相关


1

2

3


[[email protected] ~]# rpm -ivh numactl*

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

package numactl-libs-2.0.9-6.el7_2.x86_64 is already installed

如果不安装这个包会报错,错误如下(本人未测试):


1

2

3

4

5

6

7


error: Failed dependencies:

 

libnuma.so.1()(64bit) is needed by mysql-community-server-5.7.18-1.el7.x86_64

 

libnuma.so.1(libnuma_1.1)(64bit) is needed by mysql-community-server-5.7.18-1.el7.x86_64

 

libnuma.so.1(libnuma_1.2)(64bit) is needed by mysql-community-server-5.7.18-1.el7.x86_64 

若此时直接安装mysql,还会异常:


1

2

3


warning: mysql-community-libs-5.7.18-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.18-1.el7.x86_64

 mariadb-libs is obsoleted by mysql-community-libs-5.7.18-1.el7.x86_64

第一行还能看明白,是依赖问题,第二行的“mariadb-libs 被废弃”是什么鬼?废弃了为什么不提供一个新的还要出现这种弱智提示呢?

经过一番搜寻,才发现是因为在CentOS 7上已经有一个mariadb 而这个会与 MySQL的mariadb发生冲突。所以此时我们需要将系统自带的mariadb卸载掉,

然后使用mysql自带的mariadb。

接下来查看mariadb版本


1

2


[[email protected] ~]# rpm -qa | grep mariadb

mariadb-libs-5.5.52-1.el7.x86_64

卸载系统安装的mariadb


1

2

3


[[email protected] ~]# rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64

[[email protected] ~]# rpm -qa | grep mariadb

[[email protected] ~]#

解决好这个问题后,就可以安装mysql了,先解压mysql,并查看安装包


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23


[[email protected] ~]# tar -xf mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar

[[email protected] ~]# ls

anaconda-ks.cfg

libaio-0.3.109-13.el7.x86_64.rpm

miniconda2

mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar

mysql-community-client-5.7.20-1.el7.x86_64.rpm

mysql-community-common-5.7.20-1.el7.x86_64.rpm

mysql-community-devel-5.7.20-1.el7.x86_64.rpm

mysql-community-embedded-5.7.20-1.el7.x86_64.rpm

mysql-community-embedded-compat-5.7.20-1.el7.x86_64.rpm

mysql-community-embedded-devel-5.7.20-1.el7.x86_64.rpm

mysql-community-libs-5.7.20-1.el7.x86_64.rpm

mysql-community-libs-compat-5.7.20-1.el7.x86_64.rpm

mysql-community-minimal-debuginfo-5.7.20-1.el7.x86_64.rpm

mysql-community-server-5.7.20-1.el7.x86_64.rpm

mysql-community-server-minimal-5.7.20-1.el7.x86_64.rpm

mysql-community-test-5.7.20-1.el7.x86_64.rpm

numactl-2.0.9-6.el7_2.x86_64.rpm

numactl-devel-2.0.9-6.el7_2.x86_64.rpm

numactl-libs-2.0.9-6.el7_2.x86_64.rpm

perl-Data-Dumper-2.145-3.el7.x86_64.rpm

pythonshell

直接安装,报错:


1

2

3

4

5


[[email protected] ~]# rpm -ivh mysql-community-*

warning: mysql-community-client-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

error: Failed dependencies:

    net-tools is needed by mysql-community-server-5.7.20-1.el7.x86_64

    perl(JSON) is needed by mysql-community-test-5.7.20-1.el7.x86_64

貌似不能直接全安装,有顺序,继续:


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22


[[email protected] ~]# rpm -ivh mysql-community-common-5.7.20-1.el7.x86_64.rpm

warning: mysql-community-common-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

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

Updating / installing...

   1:mysql-community-common-5.7.20-1.e################################# [100%]

[[email protected] ~]# rpm -ivh mysql-community-libs-*

warning: mysql-community-libs-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

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

Updating / installing...

   1:mysql-community-libs-5.7.20-1.el7################################# [ 50%]

   2:mysql-community-libs-compat-5.7.2################################# [100%]

[[email protected] ~]# rpm -ivh mysql-community-devel-5.7.20-1.el7.x86_64.rpm

warning: mysql-community-devel-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

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

Updating / installing...

   1:mysql-community-devel-5.7.20-1.el################################# [100%]

[[email protected] ~]#

[[email protected] ~]# rpm -ivh mysql-community-server-5.7.20-1.el7.x86_64.rpm

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

error: Failed dependencies:

    mysql-community-client(x86-64) >= 5.7.9 is needed by mysql-community-server-5.7.20-1.el7.x86_64

    net-tools is needed by mysql-community-server-5.7.20-1.el7.x86_64

说缺少net-tools ,下载下来装呗,继续:

net-tools-2.0-0.22.20131004git.el7.x86_64.rpm


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20


[[email protected] ~]# rpm -ivh net-tools-2.0-0.22.20131004git.el7.x86_64.rpm

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

Updating / installing...

   1:net-tools-2.0-0.22.20131004git.el################################# [100%]

[[email protected] ~]# rpm -ivh mysql-community-server-5.7.20-1.el7.x86_64.rpm

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

error: Failed dependencies:

    mysql-community-client(x86-64) >= 5.7.9 is needed by mysql-community-server-5.7.20-1.el7.x86_64

[[email protected] ~]# rpm -ivh mysql-community-c

mysql-community-client-5.7.20-1.el7.x86_64.rpm  mysql-community-common-5.7.20-1.el7.x86_64.rpm

[[email protected] ~]# rpm -ivh mysql-community-client-5.7.20-1.el7.x86_64.rpm

warning: mysql-community-client-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

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

Updating / installing...

   1:mysql-community-client-5.7.20-1.e################################# [100%]

[[email protected] ~]# rpm -ivh mysql-community-server-5.7.20-1.el7.x86_64.rpm

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

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

Updating / installing...

   1:mysql-community-server-5.7.20-1.e################################# [100%]

中间安装server时,又说必须安装client,至此,mysql安装成功,打完收工。

5.启动查看配置


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17


[[email protected] ~]# service mysqld start

Redirecting to /bin/systemctl start  mysqld.service

[[email protected] ~]# service mysqld status

Redirecting to /bin/systemctl status  mysqld.service

● mysqld.service - MySQL Server

   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)

   Active: active (running) since Sat 2017-11-04 13:56:37 CST; 24s ago

     Docs: man:mysqld(8)

           http://dev.mysql.com/doc/refman/en/using-systemd.html

  Process: 4644 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)

  Process: 4571 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)

 Main PID: 4647 (mysqld)

   CGroup: /system.slice/mysqld.service

           └─4647 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

Nov 04 13:56:07 kylintest systemd[1]: Starting MySQL Server...

Nov 04 13:56:37 kylintest systemd[1]: Started MySQL Server.

至此,无网安装难的历史已经结束,至少的我实验没问题了,好像还缺点是什么,数据库密码是啥?


1

2


[[email protected] ~]# cat /var/log/mysqld.log | grep password

2017-11-04T05:56:08.454323Z 1 [Note] A temporary password is generated for

[email protected]: ps1DY?%T.Vc4

这样就可以登录数据库了,try一下:


1

2


[[email protected] ~]# mysql -u root

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

报错了,连输入密码的机会也没有。


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15


[[email protected] ~]# mysql -uroot -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 6

Server version: 5.7.20

Copyright (c) 2000, 2017, 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>

登陆成功试试,数据库好使不


1

2


mysql> show databases;

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

不改密码,用不了,继续:


1

2

3

4

5


mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '你的密码';

Query OK, 0 rows affected (0.02 sec)

mysql> FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.01 sec)

然后再使用SQL就没问题了


1

2

3

4

5

6

7

8

9

10


mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| sys                |

+--------------------+

4 rows in set (0.00 sec)

用数据库工具链接,出现问题:

不允许远程访问,改继续:


1

2

3

4

5


mysql>  GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION;

Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.00 sec)

再试就没有问题了,至此数据库安装问题基本没有。

查看mysql配置文件地址:


1

2

3

4

5

6


[[email protected] ~]# find / -iname '*.cnf' -print

/etc/pki/tls/openssl.cnf

/etc/my.cnf

/root/miniconda2/pkgs/openssl-1.0.2l-0/ssl/openssl.cnf

/root/miniconda2/ssl/openssl.cnf

/var/lib/mysql/auto.cnf

查看字符集:


1

2

3

4

5

6

7

8

9

10

11

12

13

14


mysql> show variables like 'char%';

+--------------------------+----------------------------+

| Variable_name            | Value                      |

+--------------------------+----------------------------+

| character_set_client     | utf8                       |

| character_set_connection | utf8                       |

| character_set_database   | latin1                     |

| character_set_filesystem | binary                     |

| character_set_results    | utf8                       |

| character_set_server     | latin1                     |

| character_set_system     | utf8                       |

| character_sets_dir       | /usr/share/mysql/charsets/ |

+--------------------------+----------------------------+

8 rows in set (0.01 sec)

至此数据库安装完毕。

原文地址:http://blog.51cto.com/lwm666/2069288

时间: 2024-11-08 12:20:25

银行 Rehat7无网部署Mysql.5.7的相关文章

CentsOS7无网情况下安装mysql5.7

1.需求就不用讲了,客户现场,政府环境,银行环境,大多是没网的,所以无网安装是很有必要的 mysql下载路径:https://dev.mysql.com/downloads/mysql/ 查看自己Linux系统版本 [[email protected] ~]# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) 往下拉继续选择 选择对应的下载,mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar 这

LNMP(nginx php-fpm mysql) 环境部署——mysql

前言: 上一篇已经说过部署的初衷,如有不清楚的,可以看下上篇的前言或在评论区留言给我. 此篇主要介绍安装mysql的方法,php会要用到mysql连接数据库 准备: mysql官网:mysql.com 源码目录:/usr/local/src mysql官方提供官方库.源码.二进制包三种安装方式.此文会分别介绍官方库.源码包的安装方式,对于二进制包,下载后可直接使用. 此文介绍mysql 5.6 社区版,在下载时不要选择错了 安装: 使用官方库安装: 1 配置mysql.repo vim /etc

Linux平台(Centos7)-lnmp一键式部署mysql,nginx,php,php-fpm服务

Linux平台(Centos7)-lnmp一键式部署mysql,nginx,php,php-fpm服务 1. 部署方式1:手动部署. 6 1.1. 配置防火墙. 6 1.2. 关闭firewall 6 1.3. 安装iptables防火墙. 6 1.4. 安装Apache 7 1.5. 安装MariaDB 9 1.5.1. 安装MariaDB 9 1.5.2. 启动服务. 10 1.5.3. 设置开机启动. 10 1.5.4. 为root账户设置密码. 11 1.5.5. 重启MariaDB 1

部署MySQL Galera Cluster

部署MySQL Galera Cluster 0.功能简介 特性 基于行复制的完全并行同步复制 实时多主架构,任意节点可读写 无延迟复制,事务零丢失,可靠健壮的读写体验. 自动化节点关系控制:节点故障自动摘除,节点加入自动协调 接近原生的MySQL数据库连接的体验 原理简析当一个事务在当前写入的节点提交后,通过wsrep API(write set replication API)将这个事务变成写集(write set)广播到同集群的其他节点中,其他节点收到写集事务后,对这个事务进行可行性检查,

docker在Linux(有网、无网)下面的安装教程

关于docker的概念,我在这里就不作说明了,直接切入正题吧! 有些客户对保密性要求比较高,因此去现场部署项目的时候,是没有网络的,这样的话,就比较难受了,网上许多无网的安装教程中需要yum指令,前提得有网络才能使用yum呀.下面将会分别介绍下有网和无网情况下docker的安装. 有网 docker ce支持64位版本 Centos 7,并且要求内核版本不低于3.10(可通过uname -r 指令查看内核信息),如果版本低于这个,不用慌,yum update 即可. 1.安装依赖包:  yum

.net中使用ODP.net访问Oracle数据库(无客户端部署方法)

.net中使用ODP.net访问Oracle数据库(无客户端部署方法) 分类: c# database2012-01-05 15:34 6330人阅读 评论(1) 收藏 举报 oracle数据库.netcomponentsdll ODP.net是Oracle提供的数据库访问类库,其功能和效率上都有所保证,它还有一个非常方便特性:在客户端上,可以不用安装Oracle客户端,直接拷贝即可使用. 以下内容转载自:http://blog.ywxyn.com/index.php/archives/326

VMWare Workstation部署MYSQL

VMWare Workstation部署MYSQL [服务器准备] 安装Vritual WorkStation之后,检查Type=NAT的连接,确认网段.192.168.33.0 新建一台虚机Redhare.contoso.com:(使用CentOS7的ISO文件),并安装操作系统 安装好操作系统后,修改网卡设置如下: 路由设置如下: 修改虚拟机的名称 1)  编辑/etc/hostname文件,改为Redhare 2) 编辑/etc/hosts文件,改为RedHare  LOCALHOST 

在 CentOS7 上部署 MySQL 主从

在 CentOS7 上部署 MySQL 主从 1 通过 SecureCRT 连接至 MySQL 主服务器: 2 找到 my.cnf 文件所在的目录: mysql --help | grep my.cnf 一般情况 my.cnf 都会位于 /etc/ 目录下: 3 用 vim 打开 MySQL 的配置文件 my.cnf: vim /etc/my.cnf 4 找到 [mysqld] 并在其后添加如下配置: # 唯一标识此 MySQL 服务器,默认值为 1,一般采用所属 IP 的末端值 server-

MYSQL-MMM主从同步部署mysql高用集群

使用mysql-mmm和mysql主从同步部署mysql高用集群 公共配置: 关闭iptables 禁用selinux 配置好yum源 固定ip 彼此间能通信 都运行数据库服务 都只有默认初始的四个库 1配置主主结构 2配置一主多从结构 3安装mysql-mmm软件 4配置mysql-mmm实现mysql高可用集群