background

The following is the script for installing mysql during development.

Task decomposition

The sequence is as follows. For details, see the script below

  1. Get the NPM package using wget
  2. Install the RPM package
  3. Yum install mysql-community-server: yum install -y mysql-community-server
  4. Start the mysql service
  5. Read the temporary password and log in using it
  6. The password can be used only after the password is changed.
  7. Log in using the new password

The script content

#! /bin/shell
Copy the code

= = = = = = = = = = = = = = =

Wget -o /etc/yom.repos. D/centos-base. Repo wget -o /etc/yom.repos http://mirrors.aliyun.com/repo/Centos-7.repo yum clean all yum makecache # download mysql RPM wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm # RPM install RPM - Uvh Mysql80-community-release-el7-3.noarch. RPM # yum install mysql80-community-release-el7-3.noarch. RPM # yum install mysql80-community-release-el7-3.noarch. RPM # yum install mysql80-community-release-el7-3.noarch Start mysqld.service # check mysqld.service # check mysqld.service # check mysqld.service Log TEMP_PWD=$(grep 'temporary password' /var/log/mysqld.log) PWD=${TEMP_PWD##*} echo "${PWD}" # Mysql -uroot -p${PWD} # ALTER USER 'root'@'localhost' IDENTIFIED BY 'Spus666! '; # exit # mysql -uroot -pspus666! Mysql > install spring-boot-plus; # source /root/mysql_spring_boot_plus.sql;Copy the code