centos7 Offline RMP Installation mysql-Pro Testing Effective

Keywords: MySQL RPM MariaDB SHA1

download

Download address of CentOS 7: https://dev.mysql.com/downloads/mysql/5.7.html#downloads

Don't choose the wrong version

I downloaded this: mysql-5.7.25-1.el7.x86_64.rpm-bundle.tar

===============================================================================================

The following installation process is reproduced from the brief book. I will not build wheels if I can test it personally.

install

I've put the installation package under the / usr/local/software path

[root@localhost software]# ls
mysql-5.7.19-1.el7.x86_64.rpm-bundle.tar

Check to see if mysql has been installed

rpm -qa | grep mysql

Unzip tar file

  • command
tar -xvf mysql-5.7.19-1.el7.x86_64.rpm-bundle.tar
  • results of enforcement
[root@localhost software]# tar -xvf mysql-5.7.19-1.el7.x86_64.rpm-bundle.tar 
mysql-community-embedded-devel-5.7.19-1.el7.x86_64.rpm
mysql-community-client-5.7.19-1.el7.x86_64.rpm
mysql-community-server-5.7.19-1.el7.x86_64.rpm
mysql-community-test-5.7.19-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.19-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.19-1.el7.x86_64.rpm
mysql-community-server-minimal-5.7.19-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.19-1.el7.x86_64.rpm
mysql-community-common-5.7.19-1.el7.x86_64.rpm
mysql-community-embedded-5.7.19-1.el7.x86_64.rpm
mysql-community-devel-5.7.19-1.el7.x86_64.rpm
mysql-community-libs-5.7.19-1.el7.x86_64.rpm

Unload Conflicting RPM Components

When we install mysql related components, if we do not remove the conflicting components, we will not be successful in installing them.
We can skip this step and go directly to the next step. There will be corresponding prompts in the process of installation. Here's a hint I came across:

# Dependency errors when installing mysql components
error: Failed dependencies:
        mysql-community-common(x86-64) >= 5.7.9 is needed by mysql-community-libs-5.7.19-1.el7.x86_64
        mariadb-libs is obsoleted by mysql-community-libs-5.7.19-1.el7.x86_64
        
# Dependency errors in uninstalling mariadb-libs
error: Failed dependencies:
        libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
        libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64

As you can see, we need to uninstall postfix and mariadb-libs related components. Unloading allows us to use rpm-ev xxx.

  • View postfix and mariadb-libs
rpm -qa | grep postfix
rpm -qa | grep mariadb
  • Execution process
[root@localhost software]# rpm -qa | grep postfix
postfix-2.10.1-6.el7.x86_64

[root@localhost software]# rpm -qa | grep mariadb
mariadb-libs-5.5.52-1.el7.x86_64
  • Unload postfix and mariadb-libs
rpm -ev postfix-2.10.1-6.el7.x86_64
rpm -ev mariadb-libs-5.5.52-1.el7.x86_64
  • Execution process
[root@localhost software]# rpm -ev postfix-2.10.1-6.el7.x86_64
Preparing packages...
postfix-2:2.10.1-6.el7.x86_64
[root@localhost software]# rpm -ev mariadb-libs-5.5.52-1.el7.x86_64
Preparing packages...
mariadb-libs-1:5.5.52-1.el7.x86_64

Installing Dependent Components

The following problems occurred while I was installing msql-community-server-xxx

[root@localhost software]# rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm 
warning: mysql-community-server-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
        /usr/bin/perl is needed by mysql-community-server-5.7.19-1.el7.x86_64
        libaio.so.1()(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64
        libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64
        libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64
        net-tools is needed by mysql-community-server-5.7.19-1.el7.x86_64
        perl(Getopt::Long) is needed by mysql-community-server-5.7.19-1.el7.x86_64
        perl(strict) is needed by mysql-community-server-5.7.19-1.el7.x86_64
[root@localhost software]# 

From the above errors, we can see that we need to install the corresponding dependencies.

  1. libaio
  2. net-tools
  3. perl
  • Installation dependency
yum -y install libaio
yum -y install net-tools
yum -y install perl

Install mysql components

After the above decompression operation, we get a lot of rpm files. But we don't need that much. We just need to install four components:

mysql-community-common-5.7.19-1.el7.x86_64.rpm
mysql-community-libs-5.7.19-1.el7.x86_64.rpm
mysql-community-client-5.7.19-1.el7.x86_64.rpm
mysql-community-server-5.7.19-1.el7.x86_64.rpm

Because of dependencies, we need to execute in sequence.
With rpm-ivh filename, the corresponding components can be installed.
When executing server, you need to rely on installing some tool components, as explained above.

  • Installation command
rpm -ivh mysql-community-common-5.7.19-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.19-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.19-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm
  • Execution process
[root@localhost software]# rpm -ivh mysql-community-common-5.7.19-1.el7.x86_64.rpm 
warning: mysql-community-common-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-common-5.7.19-1.e################################# [100%]
[root@localhost software]# rpm -ivh mysql-community-libs-5.7.19-1.el7.x86_64.rpm 
warning: mysql-community-libs-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-libs-5.7.19-1.el7################################# [100%]
[root@localhost software]# rpm -ivh mysql-community-client-5.7.19-1.el7.x86_64.rpm 
warning: mysql-community-client-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-client-5.7.19-1.e################################# [100%]
[root@localhost software]# rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-server-5.7.19-1.e################################# [100%]

Start the database

# Check whether mysql is started
service mysqld status

# mysql start
service mysqld start

# Stop mysql
service mysqld stop

# Restart mysql
service mysqld restart

Change Password

After the installation of mysql, we did not set a password, but MySQL set a temporary password for us. We can check the MySQL log to know the temporary password.

  • View Temporary Password
grep password /var/log/mysqld.log
  • Execution process
[root@localhost ~]# grep password /var/log/mysqld.log 
2017-09-01T16:43:10.889769Z 1 [Note] A temporary password is generated for root@localhost: hcLMTxbOh2?w

So we know that the temporary password is hcLMTxbOh2?w.
Then we log in to the database with this temporary password.

The database password needs to satisfy the following conditions: upper and lower case letters, numbers and special symbols

  • Executive order
# Log in to mysql, and then you need to enter your password
mysql -p

#Set password policy or you can't set simple passwords such as 123456
set global validate_password_policy=LOW;
set global validate_password_length=6; 

# Setting a new password
set password = password("Mysql_123456");

# Exit current login
quit;
  • Execution process
[root@localhost ~]# mysql -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.19 MySQL Community Server (GPL)

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> set password = password("Mysql_123456");
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> quit;

Log in again so that we can log in with a new password. We can happily operate the database.
Link: https://www.jianshu.com/p/27d0195a38ae

Posted by chaser7016 on Wed, 15 May 2019 12:09:58 -0700