yum -y install wget https://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
in /etc/yum.repos.d. repo and mysql-community-source.repo
yum -y install mysql-community-server
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”
#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
Then re-execute the "yum -y install mysql-community-server" command to install it.
Start the service:
systemctl start mysqld
If you need to set it to start automatically at boot:
systemctl enable mysqld
will automatically generate a random password in /var/log/mysqld.log, obtain the password
grep 'temporary password' /var/log/mysqld.log
Use the obtained random password to log in to the MySQL client.
mysql -uroot -p
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';
Create user:
create user 'root'@'%' identified by '123456';
Allow remote connection:
grant all privileges on *.* to 'root'@'%' with grant option;
Refresh permissions:
flush privileges;
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!