Install MySQL with one click

Source: Internet
Author: User

#!/bin/bash# # rrogram:#Installmysql# history:# .-Ten- toLuoqi V0.1release# email:#916790942@qq. com #以下rpm包需要自己下载并和该脚本放在同一目录下 #mysql-community-server-5.7. +-1. el7.x86_64.rpm mysql-community-client-5.7. +-1. el7.x86_64.rpm mysql-community-common-5.7. +-1. el7.x86_64.rpm #mysql-community-libs-5.7. +-1. el7.x86_64.rpm## dependenceYum-YInstall PerlYum-YInstall-YPerl-module-Install.noarchYum-YInstallnet-tools#created by Kevin ./Geneva/ -, modify ./Geneva/ -# -----------------------------------------------------------------------------# installation Script forThe auto-Deployment EMM (Linux edition) #-----------------------------------------------------------------------------# -----------------------------------------------------------------------------# shell Script toInstallMySQL (Default version mysql-community-5.7. +)Echo "-----------------------start install MySQL----------------------"# ADD to MySQL user and MySQL groupif[ `grep "MySQL"/etc/passwd|WC-L '-eq0]; ThenEcho "adding user MySQL"Groupadd Mysqluseradd-R-g MySQL MySQLElseEcho "MySQL user is exist"fi# Check installed MySQL or not forIinch' Rpm-qa |grep "MySQL"` Dorpm-e--allmatches $i--nodeps Done# Remove Pre-installed on OS MariaDBifexists forIinch$ (Rpm-qa |grepmariadb |grep-Vgrep) Do  Echo "Deleting rpm --"$i rpm-E--nodeps $i Done# Install mysqlserverrpm-IVH mysql-community-server-5.7. +-1. el7.x86_64.rpm mysql-community-client-5.7. +-1. el7.x86_64.rpm mysql-community-common-5.7. +-1. el7.x86_64.rpm mysql-community-libs-5.7. +-1. el7.x86_64.rpm# Check the installtation is successful or not RPM-qa |grep "MySQL"if[ $? !=0]; ThenEcho "MySQL Install fail"|Tee$mysql _instlogexit1Else Echo "MySQL Isntall success"|Tee$mysql _instlogfi# Modify configuration Files CD/etc/Echo "Character_set_server=utf8">>my.cnf# Startup The Mysqlsystemctl start mysqld systemctl status Mysqld/etc/init.d/mysqld Start/etc/init.d/mysqld StopEcho "MySQL Server Install successfully!"# ConfigurationCat/etc/my.cnfsed-I.'/mysqld/a\skip-grant-tables'/etc/my.cnfsystemctl restart mysqld# mysql-u root mysqlmysql-U root mysql-e"Use MySQL;"# Use mysql# update mysql.user set authentication_string=password ('Root') Where user='Root'; MySQL-U root mysql-e"Update Mysql.user Set Authentication_string=password (' root ') where user= ' root ';"MySQL-U root mysql-e"flush Privileges;"Cat/etc/my.cnfsed-I.'/skip-grant-tables/s/^/#/'/etc/my.cnf# MySQL-U Root-p# SET PASSWORD= PASSWORD ('Root'); MySQL-U root-proot--connect-expired-password-e"SET PASSWORD = PASSWORD (' root ');"Echo "Install successfully!!"# Exit

https://dev.mysql.com/downloads/mysql/download MySQL

Install MySQL with one click

Related Article

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.