cat <<EOF
*************************************
* 即 将 进 行 的 操 作 *
* 4. mysql -- mysql 安装 *
*************************************
EOF
cd /root
wget https://repo.mysql.com//mysql57-community-release-el6-11.noarch.rpm
yum -y install mysql57-community-release-el6-11.noarch.rpm
yum -y install mysql-community-server
service mysqld start
grep ‘temporary password‘ /var/log/mysqld.log|awk ‘{print $11}‘
echo "请手动更改密码,并创建数据库"
cat <<EOF
~]# grep ‘temporary password‘ /var/log/mysqld.log
2017-05-01T20:40:30.385752Z 1 [Note] A temporary password is generated for [email protected]: 70sgfd23
~]# mysql -u root -p #==>复制临时密码
Enter password:
mysql> SHOW DATABASES; #==>必须修改密码
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘your_passwd‘;
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
mysql> exit
~]# service mysqld restart
EOF