Steps to install MySQL 8.0.23 under Centos7 (beginner level)

Steps to install MySQL 8.0.23 under Centos7 (beginner level)

First, let me briefly introduce what MySQL is;

In short, a database is a warehouse for storing data. In order to facilitate data storage and management, it stores data on disk according to specific rules. It is a collection of data organized according to certain rules in order to achieve a certain purpose;

MySQL is an open source relational database management system (RDBMS) that uses the most commonly used database management language - Structured Query Language (SQL) for database management. Through the database management system, the data stored in the database can be effectively organized and managed.

Then our common database model:

1. Relational Database

MySql

Oracle

SQL Server

2. Non-relational database

2.1 Document storage database MongDB

2.2 Key-value storage database Redis Memcached

2,3 Column storage database HBase

2,4 Graph Database Neo4J

What are the questions about database in company interviews?

1. SQL statements operate the database

2. SQL statement operation table structure

3. Relationships between tables and classes Relationships between fields and attributes

The table corresponds to the class in Java, which is used to store the data retrieved from the database.

The field name (column) is consistent with the member variable properties in the class

The rows in the table are objects created from the class

3. Introduction to SQL statements:

MySql does not recognize Java, so it needs to interact with the language that the database recognizes.

SQL statements are the data code base

1. Environment

Virtual machine: centos7

MYSQL:mysql-8.0.23-1.el7.x86_64.rpm-bundle

①First, download the MySQL installation package

MySQL official website: https://www.mysql.com/

①丶

⑤丶

Follow the above steps to download the mysqi compressed package to your computer

2. Open the virtual machine and use the remote tool xshell to connect & CRT to connect.

I use xshell here

xshell6 download package

Link: https://pan.baidu.com/s/1MceOl8oqmVEXUK_szjnXRg

Extraction code: 9nqz

I won’t introduce virtual machines here. There are many ways to install virtual machines on the Internet. ① Open the virtual machine and then forget about it;

② Directly open xshell and enter the IP to create a remote connection

③. Enter user password

④. Login successful

3. Let’s start with the main course

Use the rpm -qa | grep mariadb command to view the installation package of mariadb

② Then uninstall mariadb through the command rpm -e mariadb-libs-5.5.56-2.el7.x86_64 --nodeps

③. Then check mariadb through rpm -qa | grep mariadb

④. Use the cd /usr/local/ command to enter the local directory under the usr directory under the root directory. This directory is used to store some local shared resources.

⑤. Check the directory structure through ll

⑥ Use the mkdir mysql command to create a directory named mysql in the current directory, and then check the newly created mysql directory.

⑦ Enter the mysql directory through cd mysql and take a look at the directory structure

⑧Then upload the previously downloaded mysql data package through the rz command

⑨Upload completed

A. Check the current directory structure through ll

B. Unzip the tarball using the command tar -xvf mysql-8.0.11-1.el7.x86_64.rpm-bundle.tar

C. Clear the screen using the clear command

D. Install common through the rpm -ivh mysql-community-common-8.0.11-1.el7.x86_64.rpm --nodeps --force command

E. Install libs through rpm -ivh mysql-community-libs-8.0.11-1.el7.x86_64.rpm --nodeps --force command

F. Install the client using the command rpm -ivh mysql-community-client-8.0.11-1.el7.x86_64.rpm --nodeps --force

G. Install the server using the command rpm -ivh mysql-community-server-8.0.11-1.el7.x86_64.rpm --nodeps --force

H. Check the installed MySQL resources through rpm -qa | grep mysql

I. Enter the following command

mysqld --initialize Initialize chown mysql:mysql /var/lib/mysql -R Authorize systemctl start mysqld Start mysql service systemctl status mysqld View mysql status 

J. Check the root initial password through cat /var/log/mysqld.log | grep password

K. Log in to mysql as root user and change the root user password

mysql -u root -p #After pressing Enter, enter the initial password above (fill in your own password)

Then enter alter user "root"@"localhost" identified by "Aa123456"; #Change password (Aa123456 is the password you set for yourself and can be changed at will)

L, then exit and verify the password

M. Authorize remote access through the following command

create user 'root'@'%' identified with mysql_native_password by 'Aa23456'; 
grant all privileges on *.* to 'root'@'%' with grant option;
flush privileges; #Effective immediately 

N. Modify the encryption rules through the ALTER USER 'root'@'localhost' IDENTIFIED BY 'root' PASSWORD EXPIRE NEVER; command. The encryption rules of MySql 8.0 and 5.0 are different, and the current visualization tool only supports the old encryption method.

O. Refresh the modified permissions through the flush privileges; command

P.

Use the following command to turn off the firewall

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

Q. Install the iptables firewall using the yum -y install iptables-services command

R, start the firewall with the following command

systemctl enable iptables;
systemctl start iptables; 

S. Edit the firewall through the vim /etc/sysconfig/iptables command and add a port

-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 

U. Restart the firewall through the systemctl restart iptables.service command to make the configuration take effect.

V. Set the firewall to start at boot via the systemctl enable iptables.service command

W. Check the IP address through the ifconfig command

X. Create a new SQLyog connection

SQLyog's Packages

Link: https://pan.baidu.com/s/1MceOl8oqmVEXUK_szjnXRg

Extraction code: 9nqz

Y. Connection successful

Z. Use the command show databases to view all databases

The MySQL installation is complete, but this is just the beginning. There are still many commands to add, delete, modify and query. Come on.

This is the end of this article about the steps to install MySQL8.0.23 under Centos7 (entry-level for beginners). For more information about installing MySQL8.0.23 under Centos7, 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:
  • Complete steps to install MySQL 5.5 on CentOS
  • The process of installing MySQL 8.0.26 on CentOS7
  • Centos7 mysql database installation and configuration tutorial
  • Centos7 installation of MySQL8 tutorial
  • Install MySQL5.5 database in CentOS7 environment

<<:  Implementation of static website layout in docker container

>>:  HTML web page hyperlink tag

Recommend

JavaScript canvas to achieve mirror image effect

This article shares the specific code for JavaScr...

What we have to say about CSS absolute and relative

Written in the opening: Absolute said: "Rela...

How to restore single table data using MySQL full database backup data

Preface When backing up the database, a full data...

Vue.js application performance optimization analysis + solution

Table of contents 1. Introduction 2. Why do we ne...

HTML input file control limits the type of uploaded files

Add an input file HTML control to the web page: &...

Docker removes abnormal container operations

This rookie encountered such a problem when he ju...

Learn MySQL database in one hour (Zhang Guo)

Table of contents 1. Database Overview 1.1 Develo...

MySQL uses find_in_set() function to implement where in() order sorting

This article introduces a tutorial about how to u...

How to install openssh from source code in centos 7

Environment: CentOS 7.1.1503 Minimum Installation...

How to use MySQL DATEDIFF function to get the time interval between two dates

describe Returns the time interval between two da...

Detailed explanation of MySQL batch SQL insert performance optimization

For some systems with large amounts of data, the ...

Sample code for CSS image animation effects (photo frame)

This article introduces the sample code of CSS pi...

Analysis of the process of building a cluster environment with Apache and Tomcat

In fact, it is not difficult to build an Apache c...