Writing in the front

As we all know, learning requires a true Linux environment. So, setting up the local environment is critical. At the same time, how to install the database in the server, has also become a difficult problem.

The online material is too old for the latest mysql8-based installation and deployment tutorial.

If there are any, they are older versions, including the official mysql documentation, which is somewhat dated. Does not meet real deployment requirements.

So, today we will complete the installation and deployment of mysql in the way of yum library.

Installation instructions

The installation is performed in single-machine mode using the YUM library

Official website to download

Download address

The installation guide

Server connection

Use a third-party SSH connection tool to connect to the server

An example is Electerm (an open source SSH and FTP tool with a high level of appearance)

RPM file Upload

Create a directory to store the mysql installation file

cd  /usr/local/
mkdir mysql
Copy the code

File upload

Perform the installation

Checking mysql Installation

yum list installed | grep mysql
Copy the code

If yes, delete it

yum remove mysql*
Copy the code

Install yum repository

cd /usr/local/mysql
rpm -ivh  mysql80-community-release-el8-1.noarch.rpm
Copy the code

Perform the installation

yum install mysql-server.x86_64 
Copy the code

Start the mysql

systemctl start mysqld
Copy the code

Configuration from the rev.

systemctl enable mysqld
Copy the code

Configure the mysql

Querying the Default Password

grep 'temporary password' /var/log/mysql/mysqld.log
Copy the code

The default password is empty

Change the password

mysql
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
Copy the code

validation

mysql -p
mysql> select version();
Copy the code

Modifying Remote Access

mysql> update mysql.user set host='%' where user="root";
mysql> flush privileges;
Copy the code

Firewall On

firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
Copy the code

Connection to use

All configuration is installed, you can use database connection software, connection use