Install mysql5.7.13 using RPM in CentOS 7

Install mysql5.7.13 using RPM in CentOS 7

0. Environment

Operating system for this article: CentOS 7.2.1511 x86_64
MySQL version: 5.7.13

1. Uninstall the mariadb-lib that comes with the system

[root@centos-linux ~]# rpm -qa|grep mariadb
mariadb-libs-5.5.44-2.el7.centos.x86_64
[root@centos-linux ~]# rpm -e mariadb-libs-5.5.44-2.el7.centos.x86_64 --nodeps

2. Download the rpm installation package

Go to the official website to find the latest rpm collection package. Now the latest is mysql-5.7.13-1.el7.x86_64.rpm-bundle.tar
Copy its download address and download it from the server (or download it locally and upload it to the server).

Copy the code as follows:
[root@centos-linux ~]# wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13-1.el7.x86_64.rpm-bundle.tar

Then unzip

[root@centos-linux ~]# ls
mysql-5.7.13-1.el7.x86_64.rpm-bundle.tar
[root@centos-linux ~]# tar xvf mysql-5.7.13-1.el7.x86_64.rpm-bundle.tar
mysql-community-test-5.7.13-1.el7.x86_64.rpm
mysql-community-embedded-5.7.13-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.13-1.el7.x86_64.rpm
mysql-community-server-5.7.13-1.el7.x86_64.rpm
mysql-community-client-5.7.13-1.el7.x86_64.rpm
mysql-community-common-5.7.13-1.el7.x86_64.rpm
mysql-community-server-minimal-5.7.13-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.13-1.el7.x86_64.rpm
mysql-community-devel-5.7.13-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.13-1.el7.x86_64.rpm
mysql-community-libs-5.7.13-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.13-1.el7.x86_64.rpm

3. Installation
Execute the following commands in sequence (several packages have dependencies, so they are executed in order) to install

[root@centos-linux ~]# rpm -ivh mysql-community-common-5.7.13-1.el7.x86_64.rpm
[root@centos-linux ~]# rpm -ivh mysql-community-libs-5.7.13-1.el7.x86_64.rpm
[root@centos-linux ~]# rpm -ivh mysql-community-client-5.7.13-1.el7.x86_64.rpm
[root@centos-linux ~]# rpm -ivh mysql-community-server-5.7.13-1.el7.x86_64.rpm

4. Database initialization

In *nix systems, to ensure that the database directory and files are owned by the mysql login user, if you run the mysql service as root, you need to execute the following command to initialize
mysqld --initialize --user=mysql
If you are running as mysql, you can remove the --user option.
In addition, the --initialize option initializes in "safe" mode by default, which will generate a password for the root user and mark the password as expired. You need to set a new password after logging in. If you use the --initialize-insecure command, you will not use safe mode and will not generate a password for the root user.
The --initialize command used here will generate a root account password, which is in the log file.

The last line in the above picture gives the generated password. Now you can start the database and log in using the above password.

[root@centos-linux ~]# systemctl start mysqld
[root@centos-linux ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.13

Copyright (c) 2000, 2016, 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>


5. Change the root password

The password has been marked as expired. If you want to use it normally, you need to change the password

mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

The previous password() function will be abandoned. The official recommendation is to use the following command to change the password

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

At the same time, if the password you set is too simple, an error will be reported.

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

For specific rules about setting passwords, please refer to this article.
Here we need to pay attention to setting the password length to be greater than 8, and it must contain numbers, uppercase and lowercase letters, and special characters.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • CentOS7 uses rpm to install MySQL 5.7 tutorial diagram
  • Detailed tutorial on installing mysql 8.0.13 (rpm) on Centos7
  • Installation tutorial of mysql8.0rpm on centos7
  • Solution to the initialization error when installing mysql5.7 from rpm package in centos6.5
  • Install MySQL 5.7.18 using rpm package under CentOS 7
  • Alibaba Cloud Centos7.3 installation mysql5.7.18 rpm installation tutorial
  • CentOS7 uses rpm package to install mysql 5.7.18
  • Tutorial on installing MySQL 5.7.9 using RPM package under CentOS 7
  • CentOS7 detailed installation of MySQL using rpm
  • Brief analysis of centos 7 mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar

<<:  How to implement remote automatic backup of MongoDB in Linux

>>:  A brief analysis of the event delegation mechanism and deep and shallow copying in JavaScript

Recommend

Creating a Secondary Menu Using JavaScript

This article example shares the specific code of ...

Public free STUN servers

Public free STUN servers When the SIP terminal us...

Two ways to export csv in win10 mysql

There are two ways to export csv in win10. The fi...

Share 5 JS high-order functions

Table of contents 1. Introduction 2. Recursion 3....

How to solve the phantom read problem in MySQL

Table of contents Preface 1. What is phantom read...

Detailed explanation of JavaScript prototype and examples

Table of contents The relationship between the co...

Summary of the use of element's form elements

There are many form elements. Here is a brief sum...

How to access the local machine (host machine) in Docker

Question How to access the local database in Dock...

Detailed explanation of the concept, principle and usage of MySQL triggers

This article uses examples to explain the concept...

Detailed explanation of how to access MySQL database remotely through Workbench

Preface Workbench is installed on one computer, a...

DHTML objects (common properties of various HTML objects)

!DOCTYPE Specifies the Document Type Definition (...

MySql 5.6.35 winx64 installation detailed tutorial

Note: There was no error in the project startup d...

SQL fuzzy query report: ORA-00909: invalid number of parameters solution

When using Oracle database for fuzzy query, The c...

Detailed explanation of MYSQL database table structure optimization method

This article uses an example to illustrate the me...

How to configure MySQL on Ubuntu 16.04 server and enable remote connection

background I am learning nodejs recently, and I r...