centos7.2 安裝mysql8.0.11 並自動初始化root密碼
阿新 • • 發佈:2018-06-04
exp AR community mysql- 8.0 AS unit mys temp
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"root@localhost: " ‘{ 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?
進入數據庫
centos7.2 安裝mysql8.0.11 並自動初始化root密碼