Detailed tutorial on installing MySQL 5.7.20 on RedHat 6.5/CentOS 6.5

Detailed tutorial on installing MySQL 5.7.20 on RedHat 6.5/CentOS 6.5

Download the rpm installation package

MySQL official website: https://dev.mysql.com/downloads/mysql/

Select version to download:

這里寫圖片描述

You can use the wget command to download:

[root@localhost opt]#wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.20-1.el6.x86_64.rpm-bundle.tar

Pay attention to the RedHat version and system bitness.

View dependent libraries

[root@localhost opt]# yum search libaio
[root@localhost opt]# yum install libaio

Check whether the system has installed MySQL related versions before

[root@localhost opt]# rpm -qa | grep mysql
[root@localhost opt]# rpm -qa | grep mariadb 

這里寫圖片描述

Delete as many as you have.

[root@localhost opt]# rpm -e mariadb-libs-5.5.44-2.el7.x86_64 --nodeps

Install

Install the packages in order

[root@localhost opt]# rpm -ivh mysql-community-common-5.7.20-1.el6.x86_64.rpm
[root@localhost opt]# rpm -ivh mysql-community-libs-5.7.20-1.el6.x86_64.rpm
[root@localhost opt]# rpm -ivh mysql-community-client-5.7.20-1.el6.x86_64.rpm
[root@localhost opt]# rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm

Create mysql user and user group

[root@localhost /]# groupadd mysql
[root@localhost /]# useradd -r -g mysql -s /bin/false mysql

Create a mysql data storage directory

[root@localhost /]# mkdir -p /data/mysql
[root@localhost /]# chown mysql.mysql /data/mysql
[root@localhost /]# ll -d /data/mysql/
drwxr-xr-x. 2 mysql mysql 6 9月17 17:37 /data/mysql/

Modify the /etc/my.cnf configuration file

[mysqld]
init-connect='SET NAMES utf8mb4'
default-storage-engine=INNODB
character-set-server=utf8mb4
datadir=/data/mysql
socket=/var/lib/mysql/mysql.sock
assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
validate_password=off
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
lower_case_table_names=1
[mysql]
default-character-set = utf8mb4
[client]
default-character-set = utf8mb4

Initialize mysql

[root@localhost /]# /usr/sbin/mysqld --initialize --user=mysql

View the initialization password

[root@localhost /]# grep "root@localhost" /var/log/mysqld.log

Log in to mysql and change the password

mysql> set password = password('123456');

Allow remote access (not recommended)

mysql> use mysql; 
mysql> select host,user,password from user; 
mysql> update user set password=password('xxxxxx') where user='root'; 
mysql> update user set host='%' where user='root' and host='localhost'; 
mysql> flush privileges;

Summarize

The above is a detailed tutorial on how to install MySQL 5.7.20 on RedHat 6.5/CentOS 6.5. 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:
  • Solution to the initialization error when installing mysql5.7 from rpm package in centos6.5
  • CentOS 6.4 MySQL 5.7.18 installation and configuration method graphic tutorial
  • Tutorial on installing and configuring MySql5.7 in Alibaba Cloud ECS centos6.8
  • Centos6.9 installation Mysql5.7.18 step record
  • CentOS6.8 uses cmake to install MySQL5.7.18
  • Detailed tutorial on installing MySQL 5.7.18 under CentOS 6.5
  • Deploy MySQL 5.7.17 binary installation and multi-instance configuration on CentOS 6.5
  • Tutorial on installing MySQL 5.7.28 on CentOS 6.2 (mysql notes)

<<:  Summary of twelve methods of Vue value transfer

>>:  View the dependent libraries of so or executable programs under linux

Blog    

Recommend

Introduction and examples of hidden fields in HTML

Basic syntax: <input type="hidden" na...

MySQL simple example of sorting Chinese characters by pinyin

If the field storing the name uses the GBK charac...

Example code for implementing anti-shake in Vue

Anti-shake: Prevent repeated clicks from triggeri...

The easiest way to install MySQL 5.7.20 using yum in CentOS 7

The default database of CentOS7 is mariadb, but m...

Example of implementing load balancing with Nginx+SpringBoot

Introduction to Load Balancing Before introducing...

HTML line spacing setting methods and problems

To set the line spacing of <p></p>, us...

Deep understanding of the mechanism of CSS background-blend-mode

This article is welcome to be shared and aggregat...

What does mysql database do?

MySQL is a relational database management system....

Detailed process of installing and configuring MySQL and Navicat prenium

Prerequisite: Mac, zsh installed, mysql downloade...

W3C Tutorial (13): W3C WSDL Activities

Web Services are concerned with application-to-ap...

The implementation of event binding this in React points to three methods

1. Arrow Function 1. Take advantage of the fact t...

Solution to MySQLSyntaxErrorException when connecting to MySQL using bitronix

Solution to MySQLSyntaxErrorException when connec...

Solution for front-end browser font size less than 12px

Preface When I was working on a project recently,...

Solve the problem of docker images disappearing

1. Mirror images disappear in 50 and 93 [root@h50...