The process of installing MySQL 8.0.26 on CentOS7

The process of installing MySQL 8.0.26 on CentOS7

1. First, download the corresponding database from the MySQL official website according to your machine: https://dev.mysql.com/downloads/mysql/

2. Use xftp to upload the compressed package to a folder on the virtual machine or server, and finally decompress the MySQL compressed package to a custom directory. If you download it on Linux, skip this step (the method is not limited).

3. Uninstall the mariadb database. First check the mariadb installation package, then uninstall it, and finally check it again to confirm. The command is as follows:

rpm -qa | grep mariadb
rpm -e mariadb-libs-5.5.68-1.el7.x86_64 --nodeps

4. Unzip the uploaded MySQL installation package. The decompression command format is: tar -xvf **. For example, I unzipped it to the /software/mysql directory, as shown below:

tar -xvf mysql-8.0.26-1.el7.x86_64.rpm-bundle.tar 

5. Then install the options in the following list and ignore the rest:

mysql-community-common
mysql-community-libs
mysql-community-client
mysql-community-server

The command is as follows:

rpm -ivh mysql-community-common-8.0.26-1.el7.x86_64.rpm --nodeps –force
rpm -ivh mysql-community-libs-8.0.26-1.el7.x86_64.rpm --nodeps –force
rpm -ivh mysql-community-client-8.0.26-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-server-8.0.26-1.el7.x86_64.rpm --nodeps --force

The implementation is as follows:

6. View the installed MySQL resources

rpm -qa | grep mysql 

7. Enter the following command to complete the initialization and related configuration of MySQL

mysqld --initialize
chown mysql:mysql /var/lib/mysql -R
systemctl start mysqld.service
systemctl enable mysqld

8. View the initial password of the database. The command is as follows:

cat /var/log/mysqld.log | grep password

9. Log in to MySQL as root user and enter the initial password

mysql -u root -p 

10. Change the root password, then exit to verify the password. The command is as follows:

alter user "root"@"localhost" identified by 1qaz@2wsx;

11. Authorize remote access through the following command

create user 'root'@'%' identified with mysql_native_password by '1qaz@2wsx'; 
grant all privileges on *.* to 'root'@'%' with grant option;
flush privileges; -- effective immediately 

12. Modify the encryption rules through the following command. The encryption rules of MySql8.0 and 5.0 are different, and the current visualization tool only supports the old encryption method. Finally, refresh the modified permissions.

ALTER USER 'root'@'localhost' IDENTIFIED BY '1qaz@2wsx' PASSWORD EXPIRE NEVER;
flush privileges;

13. Turn off the firewall through the following command

systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl mask firewalld.service 

14. Install the iptables firewall. If "Complete!" or "Complete!" appears, it means success. The command is as follows:

yum -y install iptables-services

15. Start the firewall with the following command

systemctl enable iptables;
systemctl start iptables;

16. Edit the firewall through the vi /etc/sysconfig/iptables command and add a port

vi /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8090 -j ACCEPT

17. Restart the firewall with the following command to make the configuration take effect:

systemctl restart iptables.service

18. Set the firewall to start at boot time through the command:

systemctl enable iptables.service

19. Finally, use the client tool to connect and test.

This is the end of this article about installing MySQL 8.0.26 on CentOS 7. For more information about installing MySQL 8.0.26 on CentOS 7, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • MySQL 8.0.26 installation and configuration method graphic tutorial
  • MySQL offline installation 8.0.26 graphic tutorial
  • MySQL-8.0.26 Configuration Graphics Tutorial
  • MySQL 8.0.26 installation and simplified tutorial (the most complete on the Internet)
  • Complete step-by-step record of MySQL 8.0.26 installation and uninstallation
  • MySQL 8.0.28 installation and uninstallation tutorial in Ubuntu 20
  • Ubuntu MySQL 8.0.28 installation and configuration method graphic tutorial
  • Windows free installation MySQL 8.0.28 version graphic tutorial
  • mysql 8.0.28 winx64.zip installation and configuration method graphic tutorial
  • MySQL 8.0.26 installation and configuration graphic tutorial

<<:  Summary of the differences between global objects in nodejs and browsers

>>:  5 cool and practical HTML tags and attributes introduction

Recommend

Implementation of a simple login page for WeChat applet (with source code)

Table of contents 1. Picture above 2. User does n...

How to encapsulate WangEditor rich text component in Angular

The rich text component is a very commonly used c...

CSS Back to Top Code Example

Most websites nowadays have long pages, some are ...

Mysql uses stored procedures to quickly add millions of data sample code

Preface In order to reflect the difference betwee...

Detailed explanation of several ways to install CMake on Ubuntu

apt install CMake sudo apt install cmake This met...

Hide HTML elements through display or visibility

Sometimes we need to control whether HTML elements...

Detailed Explanation of JavaScript Framework Design Patterns

Table of contents mvc mvp mvvm The source of Vue ...

8 Reasons Why You Should Use Xfce Desktop Environment for Linux

For several reasons (including curiosity), I star...

Ubuntu boot auto-start service settings

How to create a service and auto-start it in Ubun...

Detailed explanation of Vue monitoring attribute graphic example

Table of contents What is the listener property? ...

js uses cookies to remember user page operations

Preface During the development process, we someti...

MySQL 5.7.17 winx64 installation and configuration tutorial

Today I installed the MySQL database on my comput...

Detailed explanation of when javascript scripts will be executed

JavaScript scripts can be embedded anywhere in HT...

Vue large screen data display example

In order to efficiently meet requirements and avo...