linux 无外网情况下安装 mysql
由于工作需要,需要在一台装有 CentOS 系统的测试服务器上安装 MySQL ,由于该服务器上存有其他比较重要的测试数据,所以不能连接外网。由于之前安装 MySQL 一直都是使用 yum 命令一键搞定的,所以手动安装的话还是有些麻烦的。所以在这里我将我在安装过程中遇到的一些问题记录下来。
1.需求就不用讲了,客户现场,政府环境,银行环境,大多是没网的,所以无网安装是很有必要的
mysql下载路径:https://dev.mysql.com/downloads/mysql/
查看自己Linux系统版本
[root@linuxidc ~]
# 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.上传文件到服务器上
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 ~]
# 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
[root@linuxidc ~]
# 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
[root@linuxidc ~]
# 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相关
[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 mariadb
mariadb-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 ~]
# 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
直接安装,报错:
[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: 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
貌似不能直接全安装,有顺序,继续:
[root@linuxidc ~]
# 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%]
[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: NOKEY
Preparing...
################################# [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.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%]
[root@linuxidc ~]
#
[root@linuxidc ~]
# 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
[root@linuxidc ~]
# 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%]
[root@linuxidc ~]
# 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
[root@linuxidc ~]
# 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
[root@linuxidc ~]
# 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%]
[root@linuxidc ~]
# 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.启动查看配置
[root@linuxidc ~]
# service mysqld start
Redirecting to
/bin/systemctl
start mysqld.service
[root@linuxidc ~]
# 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 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 password
2017-11-04T05:56:08.454323Z 1 [Note] A temporary password is generated
for
root@localhost: ps1DY?%T.Vc4
这样就可以登录数据库了,try一下:
[root@linuxidc ~]
# mysql -u root
ERROR 1045 (28000): Access denied
for
user
'root'
@
'localhost'
(using password: NO)
报错了,连输入密码的机会也没有。
[root@linuxidc ~]
# 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>
登陆成功试试,数据库好使不
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)
至此数据库安装完毕。
转载于:https://www.cnblogs.com/yhoralce/p/8325142.html
linux 无外网情况下安装 mysql相关推荐
- 如何使用nexus3在无外网情况下(如云桌面)配置npm私库
Nexus3配置npm私服有三个类型: host:本地存储,提供本地私服功能,可上传 proxy:提供代理其他仓库的类型 group: 组类型,组合多个仓库为一个地址,最终开发人员使用镜像源为该gro ...
- 无外网情况下RPM方式安装MySQL5.6
RPM方式安装MySQL5.6 a. 检查MySQL及相关RPM包,是否安装,如果有安装,则移除(rpm –e 名称) 1 [root@localhost ~]# rpm -qa | grep -i ...
- 网络摄像头无外网情况下,与安卓手机互联查看图像,修改设置方法
近期在思考网络摄像头怎么能与安卓手机直连(通过手机typec口转网口线),测试没有成功,好多摄像头软件与手机sdk不兼容,无法使用,于是另辟蹊径,找到另外一种办法: 工具及软件: 1:无线路由器一台( ...
- Centos无网环境下安装mysql步骤
背景: 平时工作中会经常遇到没有外网的情况下安装mysql等软件的情况,由网络的话安装 MySQL 一直都是 使用 yum 命令一键搞定的,手动安装的话还是有些麻烦的. 需求就不用讲了,客户现场,政府 ...
- 服务器未联网情况下安装MySQL数据库
简介 在某些情况下在服务器是不能连接网络的,这时就无法通过yum安装MySQL数据库,但好在国内国内的很多镜像站提供了包下载功能,可以把包下载到本地后通过U盘或者光驱进行安装.在些日子我就遇到了这种情 ...
- 断网python第三方库安装_Python离线断网情况下安装numpy、pandas和matplotlib等常用第三方包...
联网情况下在命令终端CMD中输入"pip install numpy"即可自动安装,pandas和matplotlib同理一样方法进行自动安装. 工作的电脑不能上外网,所以不能通过 ...
- 安装mysql没有密码_如何在没有密码提示的情况下安装MySQL?
问题描述 我试图在没有密码提示的情况下在Ubuntu Natty上安装MySQL.但是,在主安装后的某个阶段,我总是不断提示输入密码. 另外,当我输入我认为应该是我的密码(mymysqlpass)的密 ...
- 无root权限情况下安装vim以及插件
无root权限情况下安装vim以及插件 一.概述 二.vim安装 2.1 ncurses下载安装 2.2下载vim并安装 三. vim-plug插件管理 3.1 vim-plug插件下载 3.2 插件 ...
- 断网情况下安装python_断网环境下利用pip安装Python离线安装包
著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. 这几天搞Windows离线断网环境下安装Python包,配置环境,各种坑!做个记录,供以后查询吧. # 生产环境 windows ...
最新文章
- 简单阐述hdfs的体系结构_HDFS主要特性和体系结构
- python算法与程序设计基础第二版-算法与程序设计基础(Python版) - 吴萍
- JavaScript原型彻底理解2---继承中的原型链
- linux查看进程和线程的命令
- [php]数据结构算法(PHP描述) 半折插入排序 straight binary sort
- 用一个实际例子理解Docker volume工作原理 1
- python删除第一行_Python删除文件第一行
- android url回调json,【求助】本地页面如何取某个URL返回的json
- 【编程语言】Ruby完全自学手册
- Oracle之自治事务
- .net 根据模板创建html文件
- 【XS128】Link error L1822 symbol _FADD / _FSUB/ _FDIV/ _FMUL.....错误解决的方法
- matplotlib易混概念理解与画图详解
- LINUX移植——LED驱动移植
- 关于清理系统垃圾的bat
- Mysql主从备份数据库服务器搭建
- 互联网产品运营日记(1):上线首日
- python爬取qq音乐歌词风变编程_风变编程的Python课,让我离掌握编程又进了一步...
- 学习笔记(十八):MoRe-Fi用深度学习网络从非线性信号中恢复呼吸波形
- 纯属娱乐的涂色绘画系统
热门文章
- CountDownLatch闭锁
- archlinux 开机自动连接wifi
- jsp java 分离,java与jsp页面的字符串拼接和拆分
- 场外和场内的区别_3分钟看懂场内基金和场外基金的区别!
- 课时 28:理解容器运行时接口 CRI(知谨)
- SpringCloud 应用在 Kubernetes 上的最佳实践 — 高可用(熔断)
- 国内首个 Kubernetes SIG-Cloud-Provider 子项目揭秘 | 云原生生态周报 Vol. 37
- centos7 安装mysql php,Centos7安装mysql与php的方法
- 手机控件查看工具uiautomatorviewer
- java包含点_Java的21个核心技术点,你知道吗