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

HTML validate HTML validation

HTML validate refers to HTML validation. It is the...

VUE render function usage and detailed explanation

Table of contents Preface The role of render Rend...

Graphic tutorial on installing Ubuntu 18.04 on VMware 15 virtual machine

In the past few years, I have been moving back an...

How to set Nginx to forward the domain name to the specified port

Enter /usr/local/nginx/conf sudo cd /usr/local/ng...

MySQL series tutorials for beginners

Table of contents 1. Basic concepts and basic com...

How to disable ads in the terminal welcome message in Ubuntu Server

If you are using the latest Ubuntu Server version...

MySQL 8.0.15 installation and configuration graphic tutorial under Win10

This article records the installation and configu...

JavaScript to achieve digital clock effect

This article example shares the specific code of ...

A brief discussion on MySQL event planning tasks

1. Check whether event is enabled show variables ...

JavaScript css3 to implement simple video barrage function

This article attempts to write a demo to simulate...

Install mysql offline using rpm under centos 6.4

Use the rpm installation package to install mysql...

How to delete an image in Docker

The command to delete images in docker is docker ...