1 #!/bin/bash 2 #by zhangjia 3 #2019.4.28 4 ######################### 5 6 yum -y localinstall https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm 7 yum install -y mysql-community-server 8 systemctl start mysqld.service 9 systemctl enable mysqld.service 10 11 cat /var/log/mysqld.log|grep ‘A temporary password‘ 12 #password="ZHj_1203110904" 13 password_old=`grep ‘password‘ /var/log/mysqld.log|grep ‘temporary‘|awk ‘{print $NF}‘` 14 mysqladmin -uroot -p${password_old} password ZHj1203110904! 15 mysql -uroot -pZHj1203110904! -e "grant all on *.* to [email protected]‘%‘ identified by ‘ZHj1203110904\!‘; flush privileges;" 16 mysql -uroot -pZHj1203110904! -e "show databases;"
原文地址:https://www.cnblogs.com/zhj5551/p/11198345.html
时间: 2024-10-18 08:08:53