#安裝Mysqlwget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpmyum localinstall mysql57-community-release-el7-8.noarch.rpmyum repolis ...
#安裝Mysql
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
yum localinstall mysql57-community-release-el7-8.noarch.rpm
yum repolist enabled | grep "mysql.*-community.*"
yum install mysql-community-server
systemctl start mysqld
systemctl status mysqld
systemctl enable mysqld
cp /etc/my.cnf /etc/my.cnf_`date +%Y%m%d%H%M%S`
MYSQL_PASS=$(/usr/bin/grep 'temporary password' /var/log/mysqld.log | /usr/bin/grep 'root@localhost:' | /usr/bin/sed 's/^.*root@localhost: //g')
echo $MYSQL_PASS
mysql -uroot -p$MYSQL_PASS
# mysql修改安全策略
# 修改策略項
# set global validate_password_policy=0;
# set global validate_password_mixed_case_count=0;
# set global validate_password_special_char_count=0;
# set global validate_password_length=6;
# SET PASSWORD FOR 'root'@'localhost' = PASSWORD('新的密碼');
# FLUSH PRIVILEGES;
# mysql 設置外網訪問
# grant all privileges on *.* to '用戶名'@'%' identified by '當前密碼' with grant option;
# FLUSH PRIVILEGES;