安装MySQL8.0
【摘要】 #!/bin/bash#yumwget -i -c https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpmyum -y install mysql80-community-release-el7-3.noarch.rpm#mysql8.0yum -y install mysql-community-server...
#!/bin/bash
#yum
wget -i -c https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
yum -y install mysql80-community-release-el7-3.noarch.rpm
#mysql8.0
yum -y install mysql-community-server
systemctl enable --now mysqld.service
#mysql初始化
passwd=`grep password /var/log/mysqld.log | cut -d " " -f 13`
passwd2=Lang@zuo123.
passwd3=123456
echo $passwd
sleep 2
mysql --connect-expired-password -uroot -p${passwd} -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'Lang@zuo123.';"
mysql --connect-expired-password -uroot -p${passwd2} -e "set global validate_password.policy=0;set global validate_password.length=1;"
mysql --connect-expired-password -uroot -p${passwd2} -e "use mysql;ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';"
mysql --connect-expired-password -uroot -p${passwd3} -e "use mysql;update user set host = '%' where user = 'root';"
mysql --connect-expired-password -uroot -p${passwd3} -e "ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';"
mysql -uroot -p${passwd3} -e "create database halodb character set utf8mb4 collate utf8mb4_bin;"
echo "mysql密码为passwd3"
【版权声明】本文为华为云社区用户原创内容,未经允许不得转载,如需转载请自行联系原作者进行授权。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)