linux 无外网情况下安装 mysql
由于工作需要,需要在一台装有 CentOS 系统的测试服务器上安装 MySQL ,由于该服务器上存有其他比较重要的测试数据,所以不能连接外网。由于之前安装 MySQL 一直都是使用 yum 命令一键搞定的,所以手动安装的话还是有些麻烦的。所以在这里我将我在安装过程中遇到的一些问题记录下来。
1.需求就不用讲了,客户现场,政府环境,银行环境,大多是没网的,所以无网安装是很有必要的
mysql下载路径:https://dev.mysql.com/downloads/mysql/

查看自己Linux系统版本
[root@linuxidc ~]# cat /etc/RedHat-releaseCentOS 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.上传文件到服务器上
localhost:Downloads kylin$ scp -r numactl-2.0.9-6.el7_2.x86_64.rpm root@linuxidc:/root/root@linuxidc'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 root@linuxidc:/root/root@linuxidc'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 root@linuxidc:/root/root@linuxidc'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 root@linuxidc:/root/root@linuxidc'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 root@linuxidc:/root/root@linuxidc's password:Permission denied, please try again.root@linuxidc'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 root@linuxidc:/root/root@linuxidc's password:mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar 100% 566MB 4.5MB/s 02:05查看上传的包
[root@linuxidc ~]# lsanaconda-ks.cfg numactl-devel-2.0.9-6.el7_2.x86_64.rpmlibaio-0.3.109-13.el7.x86_64.rpm numactl-libs-2.0.9-6.el7_2.x86_64.rpmminiconda2 perl-Data-Dumper-2.145-3.el7.x86_64.rpmmysql-5.7.20-1.el7.x86_64.rpm-bundle.tar pythonshellnumactl-2.0.9-6.el7_2.x86_64.rpm4.安装
第一步,先安装依赖,安装 perl-Data-Dumper-2.145-3.el7.x86_64.rpm 和 libaio-0.3.109-13.el7.x86_64.rpm
[root@linuxidc ~]# rpm -ivh libaio-0.3.109-13.el7.x86_64.rpmPreparing... ################################# [100%] package libaio-0.3.109-13.el7.x86_64 is already installed[root@linuxidc ~]# rpm -ivh perl-Data-Dumper-2.145-3.el7.x86_64.rpmPreparing... ################################# [100%]Updating / installing... 1:perl-Data-Dumper-2.145-3.el7 ################################# [100%]第二步,继续安装 numactl相关
[root@linuxidc ~]# rpm -ivh numactl*Preparing... ################################# [100%] package numactl-libs-2.0.9-6.el7_2.x86_64 is already installed如果不安装这个包会报错,错误如下(本人未测试):
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,还会异常:
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版本
[root@linuxidc ~]# rpm -qa | grep mariadbmariadb-libs-5.5.52-1.el7.x86_64卸载系统安装的mariadb
[root@linuxidc ~]# rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64[root@linuxidc ~]# rpm -qa | grep mariadb[root@linuxidc ~]#解决好这个问题后,就可以安装mysql了,先解压mysql,并查看安装包
[root@linuxidc ~]# tar -xf mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar[root@linuxidc ~]# lsanaconda-ks.cfglibaio-0.3.109-13.el7.x86_64.rpmminiconda2mysql-5.7.20-1.el7.x86_64.rpm-bundle.tarmysql-community-client-5.7.20-1.el7.x86_64.rpmmysql-community-common-5.7.20-1.el7.x86_64.rpmmysql-community-devel-5.7.20-1.el7.x86_64.rpmmysql-community-embedded-5.7.20-1.el7.x86_64.rpmmysql-community-embedded-compat-5.7.20-1.el7.x86_64.rpmmysql-community-embedded-devel-5.7.20-1.el7.x86_64.rpmmysql-community-libs-5.7.20-1.el7.x86_64.rpmmysql-community-libs-compat-5.7.20-1.el7.x86_64.rpmmysql-community-minimal-debuginfo-5.7.20-1.el7.x86_64.rpmmysql-community-server-5.7.20-1.el7.x86_64.rpmmysql-community-server-minimal-5.7.20-1.el7.x86_64.rpmmysql-community-test-5.7.20-1.el7.x86_64.rpmnumactl-2.0.9-6.el7_2.x86_64.rpmnumactl-devel-2.0.9-6.el7_2.x86_64.rpmnumactl-libs-2.0.9-6.el7_2.x86_64.rpmperl-Data-Dumper-2.145-3.el7.x86_64.rpmpythonshell直接安装,报错:
[root@linuxidc ~]# rpm -ivh mysql-community-*warning: mysql-community-client-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYerror: 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貌似不能直接全安装,有顺序,继续:
[root@linuxidc ~]# rpm -ivh mysql-community-common-5.7.20-1.el7.x86_64.rpmwarning: mysql-community-common-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ################################# [100%]Updating / installing... 1:mysql-community-common-5.7.20-1.e################################# [100%][root@linuxidc ~]# 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: NOKEYPreparing... ################################# [100%]Updating / installing... 1:mysql-community-libs-5.7.20-1.el7################################# [ 50%] 2:mysql-community-libs-compat-5.7.2################################# [100%][root@linuxidc ~]# rpm -ivh mysql-community-devel-5.7.20-1.el7.x86_64.rpmwarning: mysql-community-devel-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ################################# [100%]Updating / installing... 1:mysql-community-devel-5.7.20-1.el################################# [100%][root@linuxidc ~]#[root@linuxidc ~]# rpm -ivh mysql-community-server-5.7.20-1.el7.x86_64.rpmwarning: mysql-community-server-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYerror: 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
[root@linuxidc ~]# rpm -ivh net-tools-2.0-0.22.20131004git.el7.x86_64.rpmPreparing... ################################# [100%]Updating / installing... 1:net-tools-2.0-0.22.20131004git.el################################# [100%][root@linuxidc ~]# rpm -ivh mysql-community-server-5.7.20-1.el7.x86_64.rpmwarning: mysql-community-server-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYerror: Failed dependencies: mysql-community-client(x86-64) >= 5.7.9 is needed by mysql-community-server-5.7.20-1.el7.x86_64[root@linuxidc ~]# rpm -ivh mysql-community-cmysql-community-client-5.7.20-1.el7.x86_64.rpm mysql-community-common-5.7.20-1.el7.x86_64.rpm[root@linuxidc ~]# rpm -ivh mysql-community-client-5.7.20-1.el7.x86_64.rpmwarning: mysql-community-client-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ################################# [100%]Updating / installing... 1:mysql-community-client-5.7.20-1.e################################# [100%][root@linuxidc ~]# rpm -ivh mysql-community-server-5.7.20-1.el7.x86_64.rpmwarning: mysql-community-server-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ################################# [100%]Updating / installing... 1:mysql-community-server-5.7.20-1.e################################# [100%]中间安装server时,又说必须安装client,至此,mysql安装成功,打完收工。
5.启动查看配置
[root@linuxidc ~]# service mysqld startRedirecting to /bin/systemctl start mysqld.service[root@linuxidc ~]# service mysqld statusRedirecting 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.pidNov 04 13:56:07 linuxidc systemd[1]: Starting MySQL Server...Nov 04 13:56:37 linuxidc systemd[1]: Started MySQL Server.至此,无网安装难的历史已经结束,至少的我实验没问题了,好像还缺点是什么,数据库密码是啥?
[root@linuxidc ~]# cat /var/log/mysqld.log | grep password2017-11-04T05:56:08.454323Z 1 [Note] A temporary password is generated for root@localhost: ps1DY?%T.Vc4这样就可以登录数据库了,try一下:
[root@linuxidc ~]# mysql -u rootERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)报错了,连输入密码的机会也没有。
[root@linuxidc ~]# mysql -uroot -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 6Server version: 5.7.20Oracle 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>登陆成功试试,数据库好使不
mysql> show databases;ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.不改密码,用不了,继续:
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就没问题了
mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema || sys |+--------------------+4 rows in set (0.00 sec)用数据库工具链接,出现问题:

不允许远程访问,改继续:
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配置文件地址:
[root@linuxidc ~]# 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查看字符集:
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)至此数据库安装完毕。
linux 无外网情况下安装 mysql的更多相关文章
- centos在无外网情况下,进行yum挂载
- Python离线断网情况下安装numpy、pandas和matplotlib等常用第三方包
联网情况下在命令终端CMD中输入“pip install numpy”即可自动安装,pandas和matplotlib同理一样方法进行自动安装. 工作的电脑不能上外网,所以不能通过直接输入pip命令来 ...
- [Linux]非外网环境下配置lnmp心得
1.安装gcc编译器 基本所有编译安装包都需要gcc编译器,而且编译安装gcc也需要一个编译器,这是一个悖论.所以,这里只能寻求rpm包安装.但是rpm包需要匹配特定的操作系统内核,所以没有一个通用的 ...
- CentsOS7无网情况下安装mysql5.7
1.需求就不用讲了,客户现场,政府环境,银行环境,大多是没网的,所以无网安装是很有必要的 mysql下载路径:https://dev.mysql.com/downloads/mysql/ 查看自己Li ...
- 没有外网情况下linux安装mysql
首先linux要使用局域网 环境要求:局域网, windows系统, linux系统, mysql安装包mysql.tar.gz 注意:32位操作系统用32位安装包,64位系统用64位安装包,不 ...
- linux服务器没网情况下手动安装软件几个方法
1,找到一个有网的服务器,使用yumdownloader gcc,获取需要的rmp包: 2,在http://pkgs.org 下下载所需要的rpm包
- mysql在windows(含客户端工具)及linux(yum)环境下安装
下载 地址:https://dev.mysql.com/downloads/ windows安装包下载 linux安装包下载 https://dev.mysql.com/downloads/mysql ...
- 非[无]root权限 服务器 下安装perl以及perl模块--转载
转载自http://www.zilhua.com 在本博客中,所有的软件安装都在服务器上,且无root权限.理论上适合所有的用户. 我的安装目录 cd /home/zilhua/software 1. ...
- 非[无]root权限 服务器 下安装perl以及perl模块
转载自http://www.zilhua.com 在本博客中,所有的软件安装都在服务器上,且无root权限.理论上适合所有的用户. 我的安装目录 cd /home/zilhua/software 1. ...
随机推荐
- IIS7的CMD指令
AppCmd.exe工具所在目录 C:\windows\sytstem32\inetsrv\目录下 使用命令行管理IIS 7.0时,需要使用IIS7.0提供的全新管理工具AppCmd.exe.AppC ...
- 使用SQL查询连续号码段
原文http://www.cnblogs.com/tc310/archive/2010/09/17/1829276.html CREATE TABLE #test(fphm INT ,kshm CHA ...
- C#实现两个数据库之间的数据上报
用VS2008实现本地数据库上传数据到远程数据.数据能够是一个表,或一个表的部分数据.或查询数据.或数据编辑后上传. 其他VS版本号.复制当中代码就能够.未使用其他不论什么插件.有具体凝视. 单独页面 ...
- luigi框架--关于python运行spark程序
首先,目标是写个python脚本,跑spark程序来统计hdfs中的一些数据.参考了别人的代码,故用了luigi框架. 至于luigi的原理 底层的一些东西Google就好.本文主要就是聚焦快速使用, ...
- import MySQLdb UserWarning
Finished processing dependencies for MySQL-python==1.2.5 ╭─haoke@haokedeMBP ~/ProgramFiles/MySQL-pyt ...
- CentOS6网卡静态IP设置
CentOS网卡配置源文件如下:DEVICE=eth0HWADDR=00:0C:29:A8:67:46TYPE=EthernetUUID=4103d7a8-d073-4e93-ac68-e6f8496 ...
- 解决 同时安装 python3,python2环境时,用pip安装 python3 包
应用场景 默认mac上已经安装了 python2; 而我又安装了 python3,并使用 python3; 安装了 pip 默认,pip安装的包安装在了 python2上了: 但是我想用 pip把安装 ...
- itext测试地址
http://demo.itextsupport.com/xmlworker/?snippetChooser=headers
- 彻底告别加解密模块代码拷贝-JCE核心Cpiher详解
前提 javax.crypto.Cipher,翻译为密码,其实叫做密码器更加合适.Cipher是JCA(Java Cryptographic Extension,Java加密扩展)的核心,提供基于多种 ...
- 【转帖】Sigma水平和缺陷率的对应关系:正态分布中心和1.5标准差偏移
http://www.pinzhi.org/thread-5395-1-1.html Sigma水平和缺陷率的对应关系:正态分布中心和有1.5个标准差偏移 在过程稳定时,若给出了规范限,过程的平均与标 ...