Centos7 uses YUM to install MySQL detailed steps

Centos7 install MySQL detailed steps

Centos7 install MySQL detailed steps
First install a Centos7 in the virtual machine (VM virtual machine install Centos7)

1.1 MySQL installation

1.1.1 Download wget command

yum -y install wget

1.1.2 Download the mysql installation package online

wget https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

1.1.3 Install MySQL

rpm -ivh mysql57-community-release-el7-8.noarch.rpm

1.1.4 Install mysql service

First enter the cd /etc/yum.repos.d/ directory.
cd /etc/yum.repos.d/

Install MySQL service (this process may be a bit slow)
yum -y install mysql-server

1.1.5 Start MySQL

systemctl start mysqld

1.2 Modify MySQL temporary password

After MySQL is successfully installed, there will be a temporary password. We can use the grep command to view the temporary password. First log in to MySQL, and then modify the MySQL password.

1.2.1 Obtaining MySQL Temporary Password

grep ‘temporary password’ /var/log/mysqld.log

1.2.2 Login first with a temporary password

mysql -uroot -p

My temporary password is: a22XRJ88=+a;

1.2.3 Change MySQL password verification strength to low risk

set global validate_password_policy=LOW;

1.2.4 Modify the password length of MySQL

set global validate_password_length=5;

1.2.5 Modify MySQL password

ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘admin’;

1.3 Allow remote access

1.3.1 First, turn off the firewall of Cenotes

sudo systemctl disable firewalld

1.3.2 Modify MySQL to allow anyone to connect

1) First log in to MySQL

mysql -uroot -padmin

2) Switch to mysql data

use mysql;

3) View the user table

select Host,User from user;

It is found that the root user only allows the localhost host to log in.

4) Modified to allow any address to access

update user set Host=’%’ where User=‘root’;

5) Refresh permissions

flush privileges;

1.3.3 Use Navicat connection tool to test

Guess you like

Origin blog.csdn.net/qq_31142237/article/details/112194332