1 下载mysql-8.0.11-1.el7.x86_64.rpm-bundle.tar
2 mdkir –p /home/mysql/
3 上传tar文件到/home/mysql 并解压 tar xvf mysql-8.0.11-1.el7.x86_64.rpm-bundle.tar
4 cd /home/mysql 然后 createrepo .
5 vi /etc/yum.repos.d/mysql.repo
[mysql]
name=mysql
baseurl=file:///home/mysql
gpgcheck=0
enabled=1
6 vi install.sh
#!/bin/bash
yum install -y mysql-community-server
systemctl start mysqld.service
sleep 1
defaultmysqlpwd=`grep ‘A temporary password‘ /var/log/mysqld.log | awk -F"[email protected]: " ‘{ print $2}‘ `
/usr/bin/mysql -uroot -p"${defaultmysqlpwd}" --connect-expired-password <<EOF
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘123456Aa?‘;
EOF
sleep 1
systemctl restart mysqld
7 mysql –u root –p123456Aa?
进入数据库
原文地址:https://www.cnblogs.com/fb010001/p/9134742.html
时间: 2024-11-07 18:02:21