Centos7 installation of MySQL8 tutorial

Centos7 installation of MySQL8 tutorial

MySQL 8 new features:

My personal opinion on MySQL jumping directly from version 5.x to 8.x is as follows:

MySQL 5.5 -> MySQL 5
MySQL 5.6 -> MySQL 6
MySQL 5.7 -> MySQL 7
MySQL 8.0 -> MySQL 8

Of course, it is also possible that MySQL 6 and 7 were difficult to produce internally. Since being acquired by Oracle, MySQL 8 has the following new features:

  • MySQL Document Store
  • Default utf8mb4 encoding
  • JSON enhancements
  • CTEs
  • Window Functions
  • Descending index
  • Better optimizer consumption model
  • MySQL Server Components
  • GIS Improvement
  • InnoDB engine NO WAIT and SKIP \ LOCKED options

Centos7 Mysql8 installation steps:

1. Set up mysql source

First, you need to enable the MySQL yum repository in your system provided by MySQL. Execute one of the following commands based on your operating system version. Here we choose the source for CentOS 7 / RHEL 7

### On CentOS 7 / RHEL 7 Systems### 
rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm

### On CentOS 7 / RHEL 6 Systems### 
rpm -Uvh https://repo.mysql.com/mysql80-community-release-el6-3.noarch.rpm

###On Fedora 30### 
rpm -Uvh https://repo.mysql.com/mysql80-community-release-fc30-1.noarch.rpm

### On Fedora 29### 
rpm -Uvh https://repo.mysql.com/mysql80-community-release-fc29-2.noarch.rpm

### On Fedora 28### 
rpm -Uvh https://repo.mysql.com/mysql80-community-release-fc28-2.noarch.rpm

2. Install MySQL Community Server

The MySQL yum repository contains multiple repository configurations for multiple MySQL versions. So first disable all repositories in mysql repo file

sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/mysql-community.repo

Enable centos mysql8 version

## CentOS & RedHat version yum --enablerepo=mysql80-community install mysql-community-server
## Fedora Systems version dnf --enablerepo=mysql80-community install mysql-community-server

3. Start MySQL service

service mysqld start

Using Systemd

systemctl start mysqld.service

4. Find MySQL root password

After installing MySQL 8.0, a temporary password will be created for the MySQL root user. You can find the generated temporary password in the log file. Password file location: /var/log/mysqld.log

grep "A temporary password" /var/log/mysqld.log

5. Reset root password

After installing MySQL for the first time, execute the mysql_secure_installation command to protect the MySQL server, including the steps to reset the password.

mysql_secure_installation
Enter password for user root:

The existing password for the user account root has expired. Please set a new password.

New password:
Re-enter new password:

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

6. Add the mysql service to the startup items and start the mysql process

Using Systemd
systemctl enable mysqld.service
systemctl restart mysqld.service

7. Open port 3306

If the server has a firewall enabled, remember to open port 3306

systemctl enable iptables
systemctl start iptables
vim /etc/sysconfig/iptables
##Add -A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT to the rule
##Restart the firewall systemctl enable iptables.service
systemctl start iptables.service

If you are using Tencent Cloud's server, be sure to enable the port in the security group.

Attached are the commonly used commands of mysql:

Login to mysql

mysql -u username -p

Start mysql

systemctl start mysqld.service

End mysql

systemctl stop mysqld.service

Restart mysql

systemctl restart mysqld.service

Automatic startup

systemctl enable mysqld.service

The above is the detailed content of the tutorial on installing MySQL 8 on Centos7. For more information about installing MySQL 8 on Centos7, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • Complete steps to install MySQL 5.5 on CentOS
  • The process of installing MySQL 8.0.26 on CentOS7
  • Steps to install MySQL 8.0.23 under Centos7 (beginner level)
  • Centos7 mysql database installation and configuration tutorial
  • Install MySQL5.5 database in CentOS7 environment

<<:  MySQL database connection exception summary (worth collecting)

>>:  JavaScript to achieve simple drag effect

Recommend

How to enable JMX monitoring through Tomcat

Build a simulation environment: Operating system:...

MySQL download and installation details graphic tutorial

1. To download the MySQL database, visit the offi...

vue+element-ui implements the head navigation bar component

This article shares the specific code of vue+elem...

What to do after installing Ubuntu 20.04 (beginner's guide)

Ubuntu 20.04 has been released, bringing many new...

How to implement input checkbox to expand the click range

XML/HTML CodeCopy content to clipboard < div s...

Detailed explanation of box-sizing in CSS3 (content-box and border-box)

Box-sizing in CSS3 (content-box and border-box) T...

Analysis of the Principle of MySQL Index Length Limit

This article mainly introduces the analysis of th...

Vue implements a scroll bar style

At first, I wanted to modify the browser scroll b...

How to modify port 3389 of Windows server 2008 R2 remote desktop

The default port number of the Windows server rem...

JavaScript Basics: Scope

Table of contents Scope Global Scope Function Sco...

Nodejs module system source code analysis

Table of contents Overview CommonJS Specification...

Detailed tutorial on how to quickly install Zookeeper in Docker

Docker Quickly Install Zookeeper I haven't us...