Install MySQL-5.7.18RPM Bundle under CentOS 7.2 (applicable to the latest version of 5.7.20)

Keywords: MySQL RPM yum Oracle

1, Environment

1. Operating system: CentOS Linux release 7.2.1511 (Core) minimized installation version
2. MySQL version: MySQL-5.7.18 (mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar )

2, Installation process

1. Install wget.

[root@Geeklp-MySQL ~]# yum -y install wget

2. Download the installation package.

wget -c http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.18-1.el5.i686.rpm-bundle.tar

3. Unpack.

[root@Geeklp-MySQL ~]# tar -xf mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar

4. Install the rpm packages and other dependent packages in the following script sequence.

#!/bin/bash
yum -y install net-tools
tar -xf mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar &
yum -y remove mariadb-libs
rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm 
rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm 
rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm
yum -y install perl-Getopt-Long
rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm 
yum -y install perl-Data-Dumper
yum -y install perl-JSON
rpm -ivh mysql-community-test-5.7.18-1.el7.x86_64.rpm 
rpm -ivh mysql-community-devel-5.7.18-1.el7.x86_64.rpm

5, Start the MySQL service and record the initial password.

[root@Geeklp-MySQL ~]# systemctl start mysqld
[root@Geeklp-MySQL ~]# cat /var/log/mysqld.log |grep password
2017-12-13T10:50:44.960028Z 1 [Note] A temporary password is generated for root@localhost: =mWoe;zkj4M3

At this point, the installation process is complete.

3, Configuration process

1. First login, change the login password.

[root@Geeklp-MySQL ~]# # mysql -u root -p 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18
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('xwumpmysql,./');
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> SET PASSWORD = PASSWORD('Geeklp.0/7');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> quit;
Bye

2. Create data directory, modify my.cfn Profile.

[root@Geeklp-MySQL ~]# mkdir /home/data
[root@Geeklp-MySQL ~]# mv /var/lib/mysql /home/data/
[root@Geeklp-MySQL ~]# vi /etc/my.cnf
default-storage-engine=INNODB 
lower_case_table_names = 1

For more detailed configuration, please refer to: https://dev.mysql.com/doc/refman/5.7/en/mysqld-option-tables.html
Please refer to: https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

Posted by mrmitch on Sat, 30 May 2020 09:44:20 -0700