Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Mysql8 in Centos7

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces you how to install Mysql8 in Centos7, the content is very detailed, interested friends can refer to, hope to be helpful to you.

What's new in Mysql8:

Mysql jumped directly from 5.x to 8.x. I personally think of it this way:

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 Mysql6, 7 internal labor difficulties-_ -, since the acquisition by Oracle, vitality is still alive, mysql8 has the following new features:

MySQL document storage

Default utf8mb4 encoding

JSON enhancement

CTEs (Common Table Expresssions Common Table expression)

Window function

Descending index

A better optimizer consumption model

MySQL server components

GIS (Geographic Information System Geographic Information system) promotion

NO WAIT and SKIP\ LOCKED options for the InnoDB engine

Centos7 Mysql8 installation steps:

1. Set the mysql source

First, you need to enable the MySQL yum repository on the system provided by MySQL. Depending on your operating system version, execute one of the following commands, here we select the source of CentOS 7 / RHEL 7

?

one

two

three

four

five

six

seven

eight

nine

ten

eleven

twelve

thirteen

fourteen

# on CentOS 7 / RHEL 7 system #

Rpm-Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm

# on CentOS 7 / RHEL 6 system #

Rpm-Uvh https://repo.mysql.com/mysql80-community-release-el6-3.noarch.rpm

# on Fedora 30 system #

Rpm-Uvh https://repo.mysql.com/mysql80-community-release-fc30-1.noarch.rpm

# on Fedora 29 system #

Rpm-Uvh https://repo.mysql.com/mysql80-community-release-fc29-2.noarch.rpm

# on Fedora 28 system #

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 versions of MySQL. So first disable all repositories in the mysql repo file

?

one

Sed-I's enabledenabledenabledenabledenabledenabledEnable0Universe'/ etc/yum.repos.d/mysql-community.repo

Enable centos mysql8 version

?

one

two

three

four

# # CentOS & RedHat version

Yum-enablerepo=mysql80-community install mysql-community-server

# # Fedora Systems version

Dnf-enablerepo=mysql80-community install mysql-community-server

3. Start the MySQL service

?

one

Service mysqld start

Use Systemd

?

one

Systemctl start mysqld.service

4. Find the MySQL root password

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

?

one

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

5. Reset the root password

After installing MySQL for the first time, execute the mysql_secure_installation command to protect the MySQL server, including the step of resetting the password

?

one

Mysql_secure_installation

?

one

two

three

four

five

six

seven

eight

nine

ten

eleven

twelve

thirteen

fourteen

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. The mysql service adds the boot entry and starts the mysql process

?

one

two

three

# Using Systemd

Systemctl enable mysqld.service

Systemctl restart mysqld.service

7. Open port 3306

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

?

one

two

three

four

five

six

seven

eight

Systemctl enable iptables

Systemctl start iptables

Vim / etc/sysconfig/iptables

# # adding to the rules

-An INPUT-p tcp-m state-- state NEW-m tcp-- dport 3306-j ACCEPT

# # restart Firewall

Systemctl enable iptables.service

Systemctl start iptables.service

If you use a Tencent Cloud server, be sure to open the port in the security group.

Mysql common commands are attached:

Log in to mysql

?

one

Mysql-u username-p

Start mysql

?

one

Systemctl start mysqld.service

End mysql

?

one

Systemctl stop mysqld.service

Restart mysql

?

one

Systemctl restart mysqld.service

Self-booting

?

one

Systemctl enable mysqld.service

On how to install Mysql8 in Centos7 to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Original link: https://cloud.tencent.com/developer/article/1649952

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report