Detailed tutorial on how to install MySQL 5.7.18 in Linux (CentOS 7) using YUM

Detailed tutorial on how to install MySQL 5.7.18 in Linux (CentOS 7) using YUM

The project needs to use MySQL. Since I had always installed it in a fool-proof manner under Windows before, I basically didn't encounter any problems. However, this time I had to install it on the server. Since I was not familiar with installing software on Linux, I took a lot of detours and wasted a lot of time. Summarize it so as to avoid taking the same detour next time.

****************************The picture insertion failed, I don't know what happened*************************************

1. Various environments:

Linux version: CentOS Linux release 7.2.1511 (core)

MySQL version: community server 5.7.18

The yum installation package used:

Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package 25.1K 
Download
(mysql57-community-release-el7-11.noarch.rpm)

2. Installation steps

I first downloaded the installation package on Windows, and then imported it into the server through xshell. Then install it according to the steps on the MySQL official website. No tutorial is as reliable as the one on the official website. I have searched for many tutorials on the Internet before, and the installation method of each tutorial is different, which made me very depressed, and none of them were successful. Finally, I successfully installed it through the tutorial on the official website.

2.1 Select Installation Guide

2.2 Click to enter and select the universal binary version. installing MySQL on Unix/Linux Using Generic Binaries

2.3 Just follow the above steps step by step.

shell> yum search libaio # search for info (Mysql installation depends on the libaio library, so you need to install the libaio library first)
shell> yum install libaio # install library
shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> mkdir mysql-files
shell> chmod 750 mysql-files
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db --user=mysql # MySQL 5.7.5 (use this command for MySQL 5.7.5. If your MySQL is 5.7.6 or above, you do not need to execute this command)
shell> bin/mysqld --initialize --user=mysql # MySQL 5.7.6 and up
shell> bin/mysql_ssl_rsa_setup # MySQL 5.7.6 and up
shell> chown -R root .
shell> chown -R mysql data mysql-files
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

After completing all the above steps, the installation is complete.

2.4 After the installation is complete, start the mysql service

[root@***** /]# cd ~ #There is a problem here. I don’t know if I need to switch to the “~” directory. There was no “~” before, and the startup failed. I’m not sure if I entered the sytemctl start mysqld.service command incorrectly or for other reasons.
[root@******** ~]# systemctl start mysqld.service

Check whether the startup is successful

[root@**** * ~]# systemctl status mysqld.service

If this flag is present, the startup is successful

2.5 Get the temporary password during installation to log in to MySQL

grep'temporary
 password'/var/log/mysqld.log
2017-05-10T00:55:46.982233Z
 1 [Note] A temporary password is generated for root@localhost: 5C::+lMjqi+z

The one in the red box is a temporary password.

2.5 Log in using a temporary password

[root@****** ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.18

2.6 Change Password

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';
Query OK, 0 rows affected (0.00 sec)

Note: The latest MySQL has very high requirements for security. The password must contain special characters, uppercase and lowercase letters, and numbers. Otherwise, the change will fail and an error will be reported.

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

The above is a detailed tutorial on how to install MySQL 5.7.18 under Linux (CentOS 7) using YUM. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • How to install MySQL on Ubuntu 18.04 (linux)
  • MySQL 8.0 installation tutorial under Linux
  • Detailed tutorial on the free installation version of MySQL 5.7.18 on Linux
  • MySQL 5.6.28 installation and configuration tutorial under Linux (Ubuntu)
  • Diagram of the process from uninstallation to installation of MySQL 5.7.18 yum under Linux
  • Detailed tutorial on installing MySQL 5.7.17 on Oracle Linux 6.8
  • Install MySQL 5.7 on Ubuntu 18.04
  • Detailed tutorial on how to install mysql8.0 using Linux yum command
  • MySQL 8.0.15 installation and configuration graphic tutorial and password change under Linux
  • Complete steps to install MySQL 8.0.x on Linux

<<:  How to deploy Node.js with Docker

>>:  Detailed explanation of the WeChat applet request pre-processing method

Recommend

How InnoDB cleverly implements transaction isolation levels

Preface In the previous article Detailed Explanat...

Illustration-style website homepage design New trend in website design

You can see that their visual effects are very bea...

Summary of Vue 3 custom directive development

What is a directive? Both Angular and Vue have th...

Detailed explanation of Docker common commands Study03

Table of contents 1. Help Command 2. Mirror comma...

4 principles for clean and beautiful web design

This article will discuss these 4 principles as t...

How to reset MySQL root password

Table of contents 1. Forgot the root password and...

How to change the root password in a container using Docker

1. Use the following command to set the ssh passw...

JavaScript - Using slots in Vue: slot

Table of contents Using slots in Vue: slot Scoped...

XHTML Web Page Tutorial

This article is mainly to let beginners understan...

HTML page header code is completely clear

All the following codes are between <head>.....

HTML input box optimization to improve user experience and ease of use

In order to improve user experience and ease of us...

This article teaches you how to import CSS like JS modules

Table of contents Preface What are constructible ...