centos7 installation and configuration mysql5.7

1. Download the official mysql yum repository

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

2. Install the official yum repository of mysql

yum -y install mysql57-community-release-el7-10.noarch.rpm

3. Install mysql server

yum -y install mysql-community-server

4. Remove the official yum repository

yum -y remove mysql57-community-release-el7-10.noarch

5. Configure mysql server

5.1 View password

semanage fcontext -a -t mysqld_db_t "/vdata/mysqldata(/.*)?"

 restorecon -Rv /vdata/mysqldata/

systemctl start mysqld

grep "password" /var/log/mysqld.log

5.2 更改密码

set global validate_password_policy=0;

set global validate_password_length=1;

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

5.3 开启远程访问

GRANT ALL ON *.* TO root@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
flush privileges;

5.4 Add firewall configuration

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

 

Guess you like

Origin blog.csdn.net/superfreeman/article/details/122072561
Recommended