Home > Database > Mysql Tutorial > body text

Analysis of installing MySQL instance in CentOS7

WBOY
Release: 2023-06-03 09:34:02
forward
856 people have browsed it

1. Download and install the MySQL source

yum -y install wget https://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
Copy after login

Analysis of installing MySQL instance in CentOS7

2. Check whether mysql-community exists under

in /etc/yum.repos.d. repo and mysql-community-source.repo

Analysis of installing MySQL instance in CentOS7

3. Install MySQL

yum -y install mysql-community-server
Copy after login

Analysis of installing MySQL instance in CentOS7

If you encounter the following at this time Error:

"Public key for mysql-community-libs-compat-5.7.37-1.el7.x86_64.rpm is not installed

Failing package is: mysql-community -libs-compat-5.7.37-1.el7.x86_64

GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql”

Analysis of installing MySQL instance in CentOS7

#The reason for the above situation is that MySQL's GPG has been upgraded and needs to be obtained again.

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
Copy after login

Analysis of installing MySQL instance in CentOS7

Then re-execute the "yum -y install mysql-community-server" command to install it.

Analysis of installing MySQL instance in CentOS7

4. Start the MySQL service

Start the service:

systemctl start mysqld
Copy after login

If you need to set it to start automatically at boot:

systemctl enable mysqld
Copy after login

5. After the installation

will automatically generate a random password in /var/log/mysqld.log, obtain the password

grep 'temporary password' /var/log/mysqld.log
Copy after login

Use the obtained random password to log in to the MySQL client.

mysql -uroot -p
Copy after login

Analysis of installing MySQL instance in CentOS7

6. Set MySQL password security policy

Password strength and length (4 represents the lowest level, when the length is less than 4, the value is still 4 ) are set to the lowest level and change the password.

Password strength:

  • 0: low level, only check the length;

  • 1 : Medium level (default), length 8, and must contain numbers, uppercase and lowercase letters, and special characters;

  • 2: Strong level, needs to include a dictionary file.

set global validate_password_policy=0; 
set global validate_password_length=4;
alter user 'root'@'localhost' identified by '123456';
Copy after login

Analysis of installing MySQL instance in CentOS7

7. Set up remote login

Create user:

create user 'root'@'%' identified by '123456';
Copy after login

Allow remote connection:

grant all privileges on *.* to 'root'@'%' with grant option;
Copy after login

Refresh permissions:

flush privileges;
Copy after login

Analysis of installing MySQL instance in CentOS7

The above is the detailed content of Analysis of installing MySQL instance in CentOS7. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template