1-3 MySQL5.7 installation scripts and initialization scripts

Source: Internet
Author: User

This article refers to:

Http://www.unixfbi.com/1.html

MySQL5.7 Installation Scripts

# cat mysql.sh groupadd mysqluseradd-g mysql  -d/usr/local/mysql  -s/sbin/nologin-m mysqlid mysqlyum  instal L libaio-ymkdir/opt/mysql/-PV tar zxf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz  -c/opt/mysql/ln-s/opt/mysql/ MYSQL-5.7.18-LINUX-GLIBC2.5-X86_64/USR/LOCAL/MYSQLMKDIR/DATA/MYSQL/MYSQL3306/{DATA,LOGS,TMP}-pvchown-r Mysql.mysql/usr/local/mysqlchown-r MYSQL.MYSQL/DATACP my.cnf  /etc/my.cnfcd/usr/local/mysql./bin/mysqld-- DEFAULTS-FILE=/ETC/MY.CNF   --initializecp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld/etc/ Init.d/mysqld startecho "Export path= $PATH:/usr/local/mysql/bin" >>/etc/profilesource/etc/profilepasswd=$ ( grep ' password is '/data/mysql/mysql3306/data/error.log  | awk ' {print $NF} ') mysql-uroot-p "$PASSWD"-- CONNECT-EXPIRED-PASSWORD-E "Alter user user () identified by ' llill2019 ';" Mysql-uroot-p ' llill2019 '-e "show databases;"

  

MySQL init script

function: Restore MySQL to initialization state after each MySQL function test [[email protected]_2_33]cat/data/mysql/initmysql.sh #!/bin/bashecho] *******delete The related folder of mysql******* "service mysqld restartservice mysqld Stoprm-rf/data/mysql/mysql3306/data/*rm-rf/dat A/mysql/mysql3306/logs/*chown-r mysql.mysql/usr/local/mysqlchown-r Mysql.mysql/dataecho "*******initialize the MySQL app******* "cd/usr/local/mysql./bin/mysqld--defaults-file=/etc/my.cnf   --initializeecho" *******add the Auto-start Service for mysql******* "rm-rf/etc/init.d/mysqldcp/usr/local/mysql/support-files/mysql.server/etc/ Init.d/mysqldecho "*******start the MYSYQL Servcie and set password as ' llill2019 ' *******"/etc/init.d/mysqld startpasswd =$ (grep ' password is '/data/mysql/mysql3306/data/error.log  | awk ' {print $NF} ') mysql-uroot-p "$PASSWD"-- CONNECT-EXPIRED-PASSWORD-E "Alter user user () identified by ' llill2019 ';" Mysql-uroot-p ' llill2019 '-e "show databases;"

  

1-3 MySQL5.7 installation scripts and initialization scripts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.