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

Recommend

How to reset the root password in mysql8.0.12

After installing the database, if you accidentall...

Vue integrates Tencent TIM instant messaging

This article mainly introduces how to integrate T...

Linux CentOS MySQL database installation and configuration tutorial

Notes on installing MySQL database, share with ev...

CSS border adds four corners implementation code

1.html <div class="loginbody"> &l...

Build a severe weather real-time warning system with Node.JS

Table of contents Preface: Step 1: Find the free ...

MySQL REVOKE to delete user permissions

In MySQL, you can use the REVOKE statement to rem...

An example of how to implement an adaptive square using CSS

The traditional method is to write a square in a ...

MySQL 5.7.17 installation and configuration method graphic tutorial

This article shares the installation and configur...

Simple principles for web page layout design

This article summarizes some simple principles of...

HTML weight loss Streamline HTML tags to create web pages

HTML 4 HTML (not XHTML), MIME type is text/html, ...

vue+tp5 realizes simple login function

This article example shares the specific code of ...

How to install golang under linux

Go is an open source programming language that ma...

Steps to install MySQL 8.0.23 under Centos7 (beginner level)

First, let me briefly introduce what MySQL is; In...