CentOS 7 离线安装、初始配置及远程登录MariaDB

4 篇文章 0 订阅
2 篇文章 0 订阅

前言

由于项目需要,Linux服务器需要升级安装MariaDB10.3.15,并且服务器只能访问局域网,无法访问外网。现有一台windows可访问外网,并且可以远程Linux服务器。

准备

  1. 下载MariaDB10.3.15的安装包以及依赖包

    百度网盘 提取码:deqt

    下载后解压 mariadb.rar ,得到MariaDB10.3.15的安装包以及依赖包;
    该链接也包含下面需要用到的 pscp 工具。

  2. 下载pscp.exe,用于windows传输文件到Linux服务器;

    原网址下载

    直接 Ctrl+F 网页搜索 “pscp” 就可以找到。

操作步骤

一、传输安装文件到Linux服务器

  1. 将 pscp.exe 下载并复制到 C:\Windos\system32 目录下;

  2. 快捷键 win+R,输入 cmd ,打开 DOS ,输入以下命令:
    语法

    pscp -option <文件路径> <用户名>@<远程地址>:<远程文件路径>
    

    示例

    pscp D:\Downloads\CentOS7\mariadb.tar baymax@192.168.2.199:/share
    
    # 复制文件夹,选项改为 -r
    pscp D:\Downloads\CentOS7\ baymax@192.168.2.199:/share
    

    命令运行结果如下图: 在这里插入图片描述
    pscp :表示拷贝工具;
    <文件路径>:要拷贝的文件;
    baymax :是在Linux系统中账户的名称;
    @ :固定语法;
    <远程地址> :Linux服务器的地址;
    <远程文件路径> :冒号后面的是拷贝文件的目标位置;
    option :支持的命令行选项

    注意:

    • 如果服务器没有 share 文件夹的话会报错;
      需要在Linux服务器上创建,语法如下:

        # 切换到root用户	
        su root
        
        # 切换到根目录
        cd /
        
        # 创建文件夹 				
        mkdir share 
        
        # 查看文件				
        ls
      

      [maria@mariadb2 /]$ su root
      Password:
      [root@mariadb2 /]# cd /
      [root@mariadb2 /]# mkdir share
      [root@mariadb2 /]# ls
      bin boot dev etc home lib lib64 lost+found media mnt opt proc root run sbin share srv sys tmp usr var

    • 注意空格的位置;

    • : 后面是没有空格的;

二、安装MariaDB

# 检查是否安装Maria
rpm -qa | grep Maria
rpm -qa | grep maria

# 如果显示如下信息,则执行卸载命令

[root@localhost mariadb]# rpm -qa | grep maria
mariadb-libs-5.5.60-1.el7_5.x86_64

#卸载安装包,输入到 mariadb 之后可 按 TAB 键自动补充
yum remove mariadb-libs.x86_64

[root@mariadb2 /]# yum remove mariadb-libs.x86_64
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
–> Running transaction check
—> Package mariadb-libs.x86_64 1:5.5.60-1.el7_5 will be erased
–> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-7.el7.x86_64
–> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-7.el7.x86_64
–> Running transaction check
—> Package postfix.x86_64 2:2.10.1-7.el7 will be erased
–> Finished Dependency Resolution
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - “Could not resolve host: mirrorlist.centos.org; Unknown error”
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock error was
14: curl#6 - “Could not resolve host: mirrorlist.centos.org; Unknown error”
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=stock error was
14: curl#6 - “Could not resolve host: mirrorlist.centos.org; Unknown error”
Dependencies Resolved
============================================================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================================================
Removing:
mariadb-libs x86_64 1:5.5.60-1.el7_5 @anaconda 4.4 M
Removing for dependencies:
postfix x86_64 2:2.10.1-7.el7 @anaconda 12 M
Transaction Summary
============================================================================================================================================================================
Remove 1 Package (+1 Dependent package)
Installed size: 17 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : 2:postfix-2.10.1-7.el7.x86_64 1/2
Erasing : 1:mariadb-libs-5.5.60-1.el7_5.x86_64 2/2
Verifying : 2:postfix-2.10.1-7.el7.x86_64 1/2
Verifying : 1:mariadb-libs-5.5.60-1.el7_5.x86_64 2/2
Removed:
mariadb-libs.x86_64 1:5.5.60-1.el7_5
Dependency Removed:
postfix.x86_64 2:2.10.1-7.el7
Complete!

提示确认卸载,输入 y 回车即可

# 切换到远程传输文件的目录
cd /share/mariadb 

# 查看文件
ls

[root@mariadb2 /]# cd /share/mariadb/
[root@mariadb2 mariadb]# ls
boost-program-options-1.53.0-27.el7.x86_64.rpm libgcc-4.8.5-36.el7_6.2.x86_64.rpm mariadb.rar
cpp-4.8.5-36.el7_6.2.x86_64.rpm libgfortran-4.8.5-36.el7_6.2.x86_64.rpm MariaDB-server-10.3.15-1.el7.centos.x86_64.rpm
galera-25.3.26-1.rhel7.el7.centos.x86_64.rpm libgomp-4.8.5-36.el7_6.2.x86_64.rpm nss-softokn-freebl-3.36.0-5.el7_5.x86_64.rpm
gcc-4.8.5-36.el7_6.2.x86_64.rpm libquadmath-4.8.5-36.el7_6.2.x86_64.rpm perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm
gcc-c+±4.8.5-36.el7_6.2.x86_64.rpm libquadmath-devel-4.8.5-36.el7_6.2.x86_64.rpm perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm
gcc-gfortran-4.8.5-36.el7_6.2.x86_64.rpm libstdc+±4.8.5-36.el7_6.2.x86_64.rpm perl-DBI-1.627-4.el7.x86_64.rpm
glibc-2.17-260.el7_6.5.x86_64.rpm libstdc+±devel-4.8.5-36.el7_6.2.x86_64.rpm perl-IO-Compress-2.061-2.el7.noarch.rpm
glibc-common-2.17-260.el7_6.5.x86_64.rpm MariaDB-client-10.3.15-1.el7.centos.x86_64.rpm perl-Net-Daemon-0.48-5.el7.noarch.rpm
glibc-devel-2.17-260.el7_6.5.x86_64.rpm MariaDB-common-10.3.15-1.el7.centos.x86_64.rpm perl-PlRPC-0.2020-14.el7.noarch.rpm
glibc-headers-2.17-260.el7_6.5.x86_64.rpm MariaDB-compat-10.3.15-1.el7.centos.x86_64.rpm

使用 yum 本地安装

yum localinstall boost-program-options-1.53.0-27.el7.x86_64.rpm \
cpp-4.8.5-36.el7_6.2.x86_64.rpm \
galera-25.3.26-1.rhel7.el7.centos.x86_64.rpm \
gcc-4.8.5-36.el7_6.2.x86_64.rpm \
gcc-c++-4.8.5-36.el7_6.2.x86_64.rpm \
gcc-gfortran-4.8.5-36.el7_6.2.x86_64.rpm \
glibc-2.17-260.el7_6.5.x86_64.rpm \
glibc-common-2.17-260.el7_6.5.x86_64.rpm \
glibc-devel-2.17-260.el7_6.5.x86_64.rpm \
glibc-headers-2.17-260.el7_6.5.x86_64.rpm \
libgcc-4.8.5-36.el7_6.2.x86_64.rpm \
libgfortran-4.8.5-36.el7_6.2.x86_64.rpm \
libgomp-4.8.5-36.el7_6.2.x86_64.rpm \
libquadmath-4.8.5-36.el7_6.2.x86_64.rpm \
libquadmath-devel-4.8.5-36.el7_6.2.x86_64.rpm \
libstdc++-4.8.5-36.el7_6.2.x86_64.rpm \
libstdc++-devel-4.8.5-36.el7_6.2.x86_64.rpm \
MariaDB-client-10.3.15-1.el7.centos.x86_64.rpm \
MariaDB-common-10.3.15-1.el7.centos.x86_64.rpm \
MariaDB-compat-10.3.15-1.el7.centos.x86_64.rpm \
MariaDB-server-10.3.15-1.el7.centos.x86_64.rpm \
nss-softokn-freebl-3.36.0-5.el7_5.x86_64.rpm \
perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm \
perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm \
perl-DBI-1.627-4.el7.x86_64.rpm \
perl-IO-Compress-2.061-2.el7.noarch.rpm \
perl-Net-Daemon-0.48-5.el7.noarch.rpm \
perl-PlRPC-0.2020-14.el7.noarch.rpm

[root@mariadb2 mariadb]# yum localinstall boost-program-options-1.53.0-27.el7.x86_64.rpm
cpp-4.8.5-36.el7_6.2.x86_64.rpm
galera-25.3.26-1.rhel7.el7.centos.x86_64.rpm
gcc-4.8.5-36.el7_6.2.x86_64.rpm
gcc-c+±4.8.5-36.el7_6.2.x86_64.rpm
gcc-gfortran-4.8.5-36.el7_6.2.x86_64.rpm
glibc-2.17-260.el7_6.5.x86_64.rpm
glibc-common-2.17-260.el7_6.5.x86_64.rpm
glibc-devel-2.17-260.el7_6.5.x86_64.rpm
glibc-headers-2.17-260.el7_6.5.x86_64.rpm
libgcc-4.8.5-36.el7_6.2.x86_64.rpm
libgfortran-4.8.5-36.el7_6.2.x86_64.rpm
libgomp-4.8.5-36.el7_6.2.x86_64.rpm
libquadmath-4.8.5-36.el7_6.2.x86_64.rpm
libquadmath-devel-4.8.5-36.el7_6.2.x86_64.rpm
libstdc+±4.8.5-36.el7_6.2.x86_64.rpm
libstdc+±devel-4.8.5-36.el7_6.2.x86_64.rpm
MariaDB-client-10.3.15-1.el7.centos.x86_64.rpm
MariaDB-common-10.3.15-1.el7.centos.x86_64.rpm
MariaDB-compat-10.3.15-1.el7.centos.x86_64.rpm
MariaDB-server-10.3.15-1.el7.centos.x86_64.rpm
nss-softokn-freebl-3.36.0-5.el7_5.x86_64.rpm
perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm
perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm
perl-DBI-1.627-4.el7.x86_64.rpm
perl-IO-Compress-2.061-2.el7.noarch.rpm
perl-Net-Daemon-0.48-5.el7.noarch.rpm
perl-PlRPC-0.2020-14.el7.noarch.rpm
Loaded plugins: fastestmirror, langpacks
Examining boost-program-options-1.53.0-27.el7.x86_64.rpm: boost-program-options-1.53.0-27.el7.x86_64
Marking boost-program-options-1.53.0-27.el7.x86_64.rpm to be installed
Examining cpp-4.8.5-36.el7_6.2.x86_64.rpm: cpp-4.8.5-36.el7_6.2.x86_64
Marking cpp-4.8.5-36.el7_6.2.x86_64.rpm as an update to cpp-4.8.5-36.el7.x86_64
Examining galera-25.3.26-1.rhel7.el7.centos.x86_64.rpm: galera-25.3.26-1.rhel7.el7.centos.x86_64
Marking galera-25.3.26-1.rhel7.el7.centos.x86_64.rpm to be installed
Examining gcc-4.8.5-36.el7_6.2.x86_64.rpm: gcc-4.8.5-36.el7_6.2.x86_64
Marking gcc-4.8.5-36.el7_6.2.x86_64.rpm as an update to gcc-4.8.5-36.el7.x86_64
Examining gcc-c+±4.8.5-36.el7_6.2.x86_64.rpm: gcc-c+±4.8.5-36.el7_6.2.x86_64
Marking gcc-c+±4.8.5-36.el7_6.2.x86_64.rpm as an update to gcc-c+±4.8.5-36.el7.x86_64
Examining gcc-gfortran-4.8.5-36.el7_6.2.x86_64.rpm: gcc-gfortran-4.8.5-36.el7_6.2.x86_64
Marking gcc-gfortran-4.8.5-36.el7_6.2.x86_64.rpm as an update to gcc-gfortran-4.8.5-36.el7.x86_64
Examining glibc-2.17-260.el7_6.5.x86_64.rpm: glibc-2.17-260.el7_6.5.x86_64
Marking glibc-2.17-260.el7_6.5.x86_64.rpm as an update to glibc-2.17-260.el7.x86_64
Examining glibc-common-2.17-260.el7_6.5.x86_64.rpm: glibc-common-2.17-260.el7_6.5.x86_64
Marking glibc-common-2.17-260.el7_6.5.x86_64.rpm as an update to glibc-common-2.17-260.el7.x86_64
Examining glibc-devel-2.17-260.el7_6.5.x86_64.rpm: glibc-devel-2.17-260.el7_6.5.x86_64
Marking glibc-devel-2.17-260.el7_6.5.x86_64.rpm as an update to glibc-devel-2.17-260.el7.x86_64
Examining glibc-headers-2.17-260.el7_6.5.x86_64.rpm: glibc-headers-2.17-260.el7_6.5.x86_64
Marking glibc-headers-2.17-260.el7_6.5.x86_64.rpm as an update to glibc-headers-2.17-260.el7.x86_64
Examining libgcc-4.8.5-36.el7_6.2.x86_64.rpm: libgcc-4.8.5-36.el7_6.2.x86_64
Marking libgcc-4.8.5-36.el7_6.2.x86_64.rpm as an update to libgcc-4.8.5-36.el7.x86_64
Examining libgfortran-4.8.5-36.el7_6.2.x86_64.rpm: libgfortran-4.8.5-36.el7_6.2.x86_64
Marking libgfortran-4.8.5-36.el7_6.2.x86_64.rpm as an update to libgfortran-4.8.5-36.el7.x86_64
Examining libgomp-4.8.5-36.el7_6.2.x86_64.rpm: libgomp-4.8.5-36.el7_6.2.x86_64
Marking libgomp-4.8.5-36.el7_6.2.x86_64.rpm as an update to libgomp-4.8.5-36.el7.x86_64
Examining libquadmath-4.8.5-36.el7_6.2.x86_64.rpm: libquadmath-4.8.5-36.el7_6.2.x86_64
Marking libquadmath-4.8.5-36.el7_6.2.x86_64.rpm as an update to libquadmath-4.8.5-36.el7.x86_64
Examining libquadmath-devel-4.8.5-36.el7_6.2.x86_64.rpm: libquadmath-devel-4.8.5-36.el7_6.2.x86_64
Marking libquadmath-devel-4.8.5-36.el7_6.2.x86_64.rpm as an update to libquadmath-devel-4.8.5-36.el7.x86_64
Examining libstdc+±4.8.5-36.el7_6.2.x86_64.rpm: libstdc+±4.8.5-36.el7_6.2.x86_64
Marking libstdc+±4.8.5-36.el7_6.2.x86_64.rpm as an update to libstdc+±4.8.5-36.el7.x86_64
Examining libstdc+±devel-4.8.5-36.el7_6.2.x86_64.rpm: libstdc+±devel-4.8.5-36.el7_6.2.x86_64
Marking libstdc+±devel-4.8.5-36.el7_6.2.x86_64.rpm as an update to libstdc+±devel-4.8.5-36.el7.x86_64
Examining MariaDB-client-10.3.15-1.el7.centos.x86_64.rpm: MariaDB-client-10.3.15-1.el7.centos.x86_64
Marking MariaDB-client-10.3.15-1.el7.centos.x86_64.rpm to be installed
Examining MariaDB-common-10.3.15-1.el7.centos.x86_64.rpm: MariaDB-common-10.3.15-1.el7.centos.x86_64
Marking MariaDB-common-10.3.15-1.el7.centos.x86_64.rpm to be installed
Examining MariaDB-compat-10.3.15-1.el7.centos.x86_64.rpm: MariaDB-compat-10.3.15-1.el7.centos.x86_64
Marking MariaDB-compat-10.3.15-1.el7.centos.x86_64.rpm to be installed
Examining MariaDB-server-10.3.15-1.el7.centos.x86_64.rpm: MariaDB-server-10.3.15-1.el7.centos.x86_64
Marking MariaDB-server-10.3.15-1.el7.centos.x86_64.rpm to be installed
Examining nss-softokn-freebl-3.36.0-5.el7_5.x86_64.rpm: nss-softokn-freebl-3.36.0-5.el7_5.x86_64
nss-softokn-freebl-3.36.0-5.el7_5.x86_64.rpm: does not update installed package.
Examining perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm: perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64
Marking perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm to be installed
Examining perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm: 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64
Marking perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm to be installed
Examining perl-DBI-1.627-4.el7.x86_64.rpm: perl-DBI-1.627-4.el7.x86_64
Marking perl-DBI-1.627-4.el7.x86_64.rpm to be installed
Examining perl-IO-Compress-2.061-2.el7.noarch.rpm: perl-IO-Compress-2.061-2.el7.noarch
Marking perl-IO-Compress-2.061-2.el7.noarch.rpm to be installed
Examining perl-Net-Daemon-0.48-5.el7.noarch.rpm: perl-Net-Daemon-0.48-5.el7.noarch
Marking perl-Net-Daemon-0.48-5.el7.noarch.rpm to be installed
Examining perl-PlRPC-0.2020-14.el7.noarch.rpm: perl-PlRPC-0.2020-14.el7.noarch
Marking perl-PlRPC-0.2020-14.el7.noarch.rpm to be installed
Resolving Dependencies
–> Running transaction check
—> Package MariaDB-client.x86_64 0:10.3.15-1.el7.centos will be installed
—> Package MariaDB-common.x86_64 0:10.3.15-1.el7.centos will be installed
—> Package MariaDB-compat.x86_64 0:10.3.15-1.el7.centos will be installed
—> Package MariaDB-server.x86_64 0:10.3.15-1.el7.centos will be installed
—> Package boost-program-options.x86_64 0:1.53.0-27.el7 will be installed
—> Package cpp.x86_64 0:4.8.5-36.el7 will be updated
—> Package cpp.x86_64 0:4.8.5-36.el7_6.2 will be an update
—> Package galera.x86_64 0:25.3.26-1.rhel7.el7.centos will be installed
—> Package gcc.x86_64 0:4.8.5-36.el7 will be updated
—> Package gcc.x86_64 0:4.8.5-36.el7_6.2 will be an update
—> Package gcc-c++.x86_64 0:4.8.5-36.el7 will be updated
—> Package gcc-c++.x86_64 0:4.8.5-36.el7_6.2 will be an update
—> Package gcc-gfortran.x86_64 0:4.8.5-36.el7 will be updated
—> Package gcc-gfortran.x86_64 0:4.8.5-36.el7_6.2 will be an update
—> Package glibc.x86_64 0:2.17-260.el7 will be updated
—> Package glibc.x86_64 0:2.17-260.el7_6.5 will be an update
—> Package glibc-common.x86_64 0:2.17-260.el7 will be updated
—> Package glibc-common.x86_64 0:2.17-260.el7_6.5 will be an update
—> Package glibc-devel.x86_64 0:2.17-260.el7 will be updated
—> Package glibc-devel.x86_64 0:2.17-260.el7_6.5 will be an update
—> Package glibc-headers.x86_64 0:2.17-260.el7 will be updated
—> Package glibc-headers.x86_64 0:2.17-260.el7_6.5 will be an update
—> Package libgcc.x86_64 0:4.8.5-36.el7 will be updated
—> Package libgcc.x86_64 0:4.8.5-36.el7_6.2 will be an update
—> Package libgfortran.x86_64 0:4.8.5-36.el7 will be updated
—> Package libgfortran.x86_64 0:4.8.5-36.el7_6.2 will be an update
—> Package libgomp.x86_64 0:4.8.5-36.el7 will be updated
—> Package libgomp.x86_64 0:4.8.5-36.el7_6.2 will be an update
—> Package libquadmath.x86_64 0:4.8.5-36.el7 will be updated
—> Package libquadmath.x86_64 0:4.8.5-36.el7_6.2 will be an update
—> Package libquadmath-devel.x86_64 0:4.8.5-36.el7 will be updated
—> Package libquadmath-devel.x86_64 0:4.8.5-36.el7_6.2 will be an update
—> Package libstdc++.x86_64 0:4.8.5-36.el7 will be updated
—> Package libstdc++.x86_64 0:4.8.5-36.el7_6.2 will be an update
—> Package libstdc+±devel.x86_64 0:4.8.5-36.el7 will be updated
—> Package libstdc+±devel.x86_64 0:4.8.5-36.el7_6.2 will be an update
—> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
—> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
—> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
—> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed
—> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
—> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
–> Finished Dependency Resolution
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - “Could not resolve host: mirrorlist.centos.org; Unknown error”
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock error was
14: curl#6 - “Could not resolve host: mirrorlist.centos.org; Unknown error”
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=stock error was
14: curl#6 - “Could not resolve host: mirrorlist.centos.org; Unknown error”
Dependencies Resolved
============================================================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================================================
Installing:
MariaDB-client x86_64 10.3.15-1.el7.centos /MariaDB-client-10.3.15-1.el7.centos.x86_64 57 M
MariaDB-common x86_64 10.3.15-1.el7.centos /MariaDB-common-10.3.15-1.el7.centos.x86_64 294 k
MariaDB-compat x86_64 10.3.15-1.el7.centos /MariaDB-compat-10.3.15-1.el7.centos.x86_64 14 M
MariaDB-server x86_64 10.3.15-1.el7.centos /MariaDB-server-10.3.15-1.el7.centos.x86_64 120 M
boost-program-options x86_64 1.53.0-27.el7 /boost-program-options-1.53.0-27.el7.x86_64 917 k
galera x86_64 25.3.26-1.rhel7.el7.centos /galera-25.3.26-1.rhel7.el7.centos.x86_64 35 M
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 /perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 57 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 /perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 137 k
perl-DBI x86_64 1.627-4.el7 /perl-DBI-1.627-4.el7.x86_64 1.9 M
perl-IO-Compress noarch 2.061-2.el7 /perl-IO-Compress-2.061-2.el7.noarch 795 k
perl-Net-Daemon noarch 0.48-5.el7 /perl-Net-Daemon-0.48-5.el7.noarch 116 k
perl-PlRPC noarch 0.2020-14.el7 /perl-PlRPC-0.2020-14.el7.noarch 69 k
Updating:
cpp x86_64 4.8.5-36.el7_6.2 /cpp-4.8.5-36.el7_6.2.x86_64 15 M
gcc x86_64 4.8.5-36.el7_6.2 /gcc-4.8.5-36.el7_6.2.x86_64 37 M
gcc-c++ x86_64 4.8.5-36.el7_6.2 /gcc-c+±4.8.5-36.el7_6.2.x86_64 16 M
gcc-gfortran x86_64 4.8.5-36.el7_6.2 /gcc-gfortran-4.8.5-36.el7_6.2.x86_64 16 M
glibc x86_64 2.17-260.el7_6.5 /glibc-2.17-260.el7_6.5.x86_64 14 M
glibc-common x86_64 2.17-260.el7_6.5 /glibc-common-2.17-260.el7_6.5.x86_64 115 M
glibc-devel x86_64 2.17-260.el7_6.5 /glibc-devel-2.17-260.el7_6.5.x86_64 1.0 M
glibc-headers x86_64 2.17-260.el7_6.5 /glibc-headers-2.17-260.el7_6.5.x86_64 2.2 M
libgcc x86_64 4.8.5-36.el7_6.2 /libgcc-4.8.5-36.el7_6.2.x86_64 175 k
libgfortran x86_64 4.8.5-36.el7_6.2 /libgfortran-4.8.5-36.el7_6.2.x86_64 1.1 M
libgomp x86_64 4.8.5-36.el7_6.2 /libgomp-4.8.5-36.el7_6.2.x86_64 207 k
libquadmath x86_64 4.8.5-36.el7_6.2 /libquadmath-4.8.5-36.el7_6.2.x86_64 276 k
libquadmath-devel x86_64 4.8.5-36.el7_6.2 /libquadmath-devel-4.8.5-36.el7_6.2.x86_64 18 k
libstdc++ x86_64 4.8.5-36.el7_6.2 /libstdc+±4.8.5-36.el7_6.2.x86_64 1.0 M
libstdc+±devel x86_64 4.8.5-36.el7_6.2 /libstdc+±devel-4.8.5-36.el7_6.2.x86_64 8.0 M
Transaction Summary
============================================================================================================================================================================
Install 12 Packages
Upgrade 15 Packages
Total size: 458 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : libgcc-4.8.5-36.el7_6.2.x86_64 1/42
Updating : glibc-common-2.17-260.el7_6.5.x86_64 2/42
Updating : glibc-2.17-260.el7_6.5.x86_64 3/42
Updating : libstdc+±4.8.5-36.el7_6.2.x86_64 4/42
Installing : MariaDB-common-10.3.15-1.el7.centos.x86_64 5/42
Installing : MariaDB-compat-10.3.15-1.el7.centos.x86_64 6/42
Updating : libquadmath-4.8.5-36.el7_6.2.x86_64 7/42
Updating : libgfortran-4.8.5-36.el7_6.2.x86_64 8/42
Installing : MariaDB-client-10.3.15-1.el7.centos.x86_64 9/42
Installing : boost-program-options-1.53.0-27.el7.x86_64 10/42
Installing : galera-25.3.26-1.rhel7.el7.centos.x86_64 11/42
Updating : libstdc+±devel-4.8.5-36.el7_6.2.x86_64 12/42
Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 13/42
Updating : libgomp-4.8.5-36.el7_6.2.x86_64 14/42
Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 15/42
Installing : perl-IO-Compress-2.061-2.el7.noarch 16/42
Updating : glibc-headers-2.17-260.el7_6.5.x86_64 17/42
Updating : glibc-devel-2.17-260.el7_6.5.x86_64 18/42
Updating : cpp-4.8.5-36.el7_6.2.x86_64 19/42
Updating : gcc-4.8.5-36.el7_6.2.x86_64 20/42
Updating : libquadmath-devel-4.8.5-36.el7_6.2.x86_64 21/42
Installing : perl-Net-Daemon-0.48-5.el7.noarch 22/42
Installing : perl-PlRPC-0.2020-14.el7.noarch 23/42
Installing : perl-DBI-1.627-4.el7.x86_64 24/42
Installing : MariaDB-server-10.3.15-1.el7.centos.x86_64 25/42
chown: invalid user: ‘mysql’
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:
‘/usr/bin/mysqladmin’ -u root password ‘new-password’
‘/usr/bin/mysqladmin’ -u root -h mariadb2 password ‘new-password’
Alternatively you can run:
‘/usr/bin/mysql_secure_installation’
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.
Please report any problems at http://mariadb.org/jira
The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB’s strong and vibrant community:
https://mariadb.org/get-involved/
Updating : gcc-gfortran-4.8.5-36.el7_6.2.x86_64 26/42
Updating : gcc-c+±4.8.5-36.el7_6.2.x86_64 27/42
Cleanup : gcc-gfortran-4.8.5-36.el7.x86_64 28/42
Cleanup : gcc-c+±4.8.5-36.el7.x86_64 29/42
Cleanup : libquadmath-devel-4.8.5-36.el7.x86_64 30/42
Cleanup : gcc-4.8.5-36.el7.x86_64 31/42
Cleanup : libgfortran-4.8.5-36.el7.x86_64 32/42
Cleanup : glibc-devel-2.17-260.el7.x86_64 33/42
Cleanup : glibc-headers-2.17-260.el7.x86_64 34/42
Cleanup : libstdc+±devel-4.8.5-36.el7.x86_64 35/42
Cleanup : libstdc+±4.8.5-36.el7.x86_64 36/42
Cleanup : libquadmath-4.8.5-36.el7.x86_64 37/42
Cleanup : cpp-4.8.5-36.el7.x86_64 38/42
Cleanup : libgomp-4.8.5-36.el7.x86_64 39/42
Cleanup : glibc-common-2.17-260.el7.x86_64 40/42
Cleanup : glibc-2.17-260.el7.x86_64 41/42
Cleanup : libgcc-4.8.5-36.el7.x86_64 42/42
Verifying : MariaDB-server-10.3.15-1.el7.centos.x86_64 1/42
Verifying : perl-IO-Compress-2.061-2.el7.noarch 2/42
Verifying : libgfortran-4.8.5-36.el7_6.2.x86_64 3/42
Verifying : galera-25.3.26-1.rhel7.el7.centos.x86_64 4/42
Verifying : gcc-4.8.5-36.el7_6.2.x86_64 5/42
Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 6/42
Verifying : libstdc+±4.8.5-36.el7_6.2.x86_64 7/42
Verifying : MariaDB-client-10.3.15-1.el7.centos.x86_64 8/42
Verifying : glibc-devel-2.17-260.el7_6.5.x86_64 9/42
Verifying : libgcc-4.8.5-36.el7_6.2.x86_64 10/42
Verifying : libgomp-4.8.5-36.el7_6.2.x86_64 11/42
Verifying : glibc-common-2.17-260.el7_6.5.x86_64 12/42
Verifying : glibc-2.17-260.el7_6.5.x86_64 13/42
Verifying : boost-program-options-1.53.0-27.el7.x86_64 14/42
Verifying : perl-DBI-1.627-4.el7.x86_64 15/42
Verifying : libstdc+±devel-4.8.5-36.el7_6.2.x86_64 16/42
Verifying : gcc-c+±4.8.5-36.el7_6.2.x86_64 17/42
Verifying : gcc-gfortran-4.8.5-36.el7_6.2.x86_64 18/42
Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 19/42
Verifying : libquadmath-devel-4.8.5-36.el7_6.2.x86_64 20/42
Verifying : perl-PlRPC-0.2020-14.el7.noarch 21/42
Verifying : libquadmath-4.8.5-36.el7_6.2.x86_64 22/42
Verifying : glibc-headers-2.17-260.el7_6.5.x86_64 23/42
Verifying : MariaDB-common-10.3.15-1.el7.centos.x86_64 24/42
Verifying : cpp-4.8.5-36.el7_6.2.x86_64 25/42
Verifying : perl-Net-Daemon-0.48-5.el7.noarch 26/42
Verifying : MariaDB-compat-10.3.15-1.el7.centos.x86_64 27/42
Verifying : libgcc-4.8.5-36.el7.x86_64 28/42
Verifying : libstdc+±4.8.5-36.el7.x86_64 29/42
Verifying : glibc-2.17-260.el7.x86_64 30/42
Verifying : libgfortran-4.8.5-36.el7.x86_64 31/42
Verifying : gcc-4.8.5-36.el7.x86_64 32/42
Verifying : gcc-gfortran-4.8.5-36.el7.x86_64 33/42
Verifying : libstdc+±devel-4.8.5-36.el7.x86_64 34/42
Verifying : cpp-4.8.5-36.el7.x86_64 35/42
Verifying : libgomp-4.8.5-36.el7.x86_64 36/42
Verifying : glibc-common-2.17-260.el7.x86_64 37/42
Verifying : libquadmath-4.8.5-36.el7.x86_64 38/42
Verifying : gcc-c+±4.8.5-36.el7.x86_64 39/42
Verifying : glibc-devel-2.17-260.el7.x86_64 40/42
Verifying : libquadmath-devel-4.8.5-36.el7.x86_64 41/42
Verifying : glibc-headers-2.17-260.el7.x86_64 42/42
Installed:
MariaDB-client.x86_64 0:10.3.15-1.el7.centos MariaDB-common.x86_64 0:10.3.15-1.el7.centos MariaDB-compat.x86_64 0:10.3.15-1.el7.centos
MariaDB-server.x86_64 0:10.3.15-1.el7.centos boost-program-options.x86_64 0:1.53.0-27.el7 galera.x86_64 0:25.3.26-1.rhel7.el7.centos
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBI.x86_64 0:1.627-4.el7
perl-IO-Compress.noarch 0:2.061-2.el7 perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7
Updated:
cpp.x86_64 0:4.8.5-36.el7_6.2 gcc.x86_64 0:4.8.5-36.el7_6.2 gcc-c++.x86_64 0:4.8.5-36.el7_6.2 gcc-gfortran.x86_64 0:4.8.5-36.el7_6.2
glibc.x86_64 0:2.17-260.el7_6.5 glibc-common.x86_64 0:2.17-260.el7_6.5 glibc-devel.x86_64 0:2.17-260.el7_6.5 glibc-headers.x86_64 0:2.17-260.el7_6.5
libgcc.x86_64 0:4.8.5-36.el7_6.2 libgfortran.x86_64 0:4.8.5-36.el7_6.2 libgomp.x86_64 0:4.8.5-36.el7_6.2 libquadmath.x86_64 0:4.8.5-36.el7_6.2
libquadmath-devel.x86_64 0:4.8.5-36.el7_6.2 libstdc++.x86_64 0:4.8.5-36.el7_6.2 libstdc+±devel.x86_64 0:4.8.5-36.el7_6.2
Complete!

看到 Complete! 就表示成功了,接下来就是启动服务和登录数据库;

# 启动服务
systemctl start mariadb

#设置开机启动
systemctl enable mariadb

#查看mariadb运行状态
systemctl status mariadb

[root@mariadb2 mariadb]# systemctl start mariadb
[root@mariadb2 mariadb]# systemctl enable mariadb
[root@mariadb2 mariadb]# systemctl status mariadb
● mariadb.service - MariaDB 10.3.15 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: active (running) since Wed 2019-05-29 03:19:27 CST; 44s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 4508 (mysqld)
Status: “Taking your SQL requests now…”
CGroup: /system.slice/mariadb.service
└─4508 /usr/sbin/mysqld
May 29 03:19:26 mariadb2 mysqld[4508]: 2019-05-29 3:19:26 0 [Note] InnoDB: 10.3.15 started; log sequence number 1630815; transaction id 21
May 29 03:19:26 mariadb2 mysqld[4508]: 2019-05-29 3:19:26 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
May 29 03:19:26 mariadb2 mysqld[4508]: 2019-05-29 3:19:26 0 [Note] InnoDB: Buffer pool(s) load completed at 190529 3:19:26
May 29 03:19:26 mariadb2 mysqld[4508]: 2019-05-29 3:19:26 0 [Note] Plugin ‘FEEDBACK’ is disabled.
May 29 03:19:26 mariadb2 mysqld[4508]: 2019-05-29 3:19:26 0 [Note] Server socket created on IP: ‘::’.
May 29 03:19:26 mariadb2 mysqld[4508]: 2019-05-29 3:19:26 0 [Note] Reading of all Master_info entries succeded
May 29 03:19:26 mariadb2 mysqld[4508]: 2019-05-29 3:19:26 0 [Note] Added new Master_info ‘’ to hash table
May 29 03:19:26 mariadb2 mysqld[4508]: 2019-05-29 3:19:26 0 [Note] /usr/sbin/mysqld: ready for connections.
May 29 03:19:26 mariadb2 mysqld[4508]: Version: ‘10.3.15-MariaDB’ socket: ‘/var/lib/mysql/mysql.sock’ port: 3306 MariaDB Server
May 29 03:19:27 mariadb2 systemd[1]: Started MariaDB 10.3.15 database server.

# 登录数据库
mysql -u root -p

[root@mariadb2 mariadb]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.3.15-MariaDB MariaDB Server
Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]>

现在 root 为空,直接回车即可,出现以上信息说明你进入MariaDB了;
现在咱们去修改 root 密码:

#选择 mysql 数据库
use mysql;
#更改 root 用户密码
update user set password=PASSWORD("newpass")where user="root";
#更新权限
flush privileges; 

注意: newpass 为 root 的登录密码,请自行更改!

MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> update user set password=PASSWORD(“1111”)where user=“root”;
Query OK, 4 rows affected (0.002 sec)
Rows matched: 4 Changed: 4 Warnings: 0
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.001 sec)

三、开启 MariaDB 的远程访问权限:

设置任何远程主机都可以访问数据库
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'newpass' WITH GRANT OPTION;

%表示针对所有IP,password表示将用这个密码登录root用户

如果想只让某个IP段的主机连接,可以修改为:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.100.%' IDENTIFIED BY 'newpassd' WITH GRANT OPTION;

#更新权限
flush privileges; 
#退出
quit;

MariaDB [mysql]> GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;
Query OK, 0 rows affected (0.001 sec)
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.001 sec)
MariaDB [mysql]> quit
Bye

测试一下远程是否成功开启:

#登录 172.18.107.182 的数据库,-h 表示远程数据库地址
mysql -u root -p -h 172.18.107.182

[root@mariadb2 mariadb]# mysql -u root -p -h 172.18.107.182
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.3.15-MariaDB MariaDB Server
Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]>

出现以上信息表示远程成功开启了。

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值