#!/bin/bash
#
# Rrogram:
# install mysql
# History:
# -- luoqi v0. release
# email:
# @qq.com
#以下rpm包需要自己下载并和该脚本放在同一目录下
#mysql-community-server-5.7.-.el7.x86_64.rpm mysql-community-client-5.7.-.el7.x86_64.rpm mysql-community-common-5.7.-.el7.x86_64.rpm #mysql-community-libs-5.7.-.el7.x86_64.rpm
# # dependence
yum -y install perl
yum -y install -y perl-Module-Install.noarch
yum -y install net-tools
#created by Kevin //, modify //
# -----------------------------------------------------------------------------
# Installation Script for the auto-deployment EMM(Linux edition)
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# shell script to install MySQL (default version mysql-community-5.7.) echo "-----------------------start install mysql----------------------" # Add to mysql user and mysql group if [ `grep "mysql" /etc/passwd | wc -l` -eq ];then
echo "adding user mysql"
groupadd mysql
useradd -r -g mysql mysql
else
echo "mysql user is exist"
fi # check installed mysql or not
for i in `rpm -qa | grep "mysql"`
do
rpm -e --allmatches $i --nodeps
done # Remove pre-installed on OS MariaDB if exists for i in $(rpm -qa | grep mariadb | grep -v grep)
do
echo "Deleting rpm --> "$i
rpm -e --nodeps $i
done # Install mysqlserver
rpm -ivh mysql-community-server-5.7.-.el7.x86_64.rpm mysql-community-client-5.7.-.el7.x86_64.rpm mysql-community-common-5.7.-.el7.x86_64.rpm mysql-community-libs-5.7.-.el7.x86_64.rpm # check the installtation was successful or not
rpm -qa |grep "mysql"
if [ $? != ];then
echo "mysql install fail"| tee $mysql_instlog
exit
else
echo "mysql isntall success"| tee $mysql_instlog
fi # modify configuration files
cd /etc/
echo "character_set_server=utf8" >> my.cnf # startup the mysql
systemctl start mysqld
systemctl status mysqld
/etc/init.d/mysqld start
/etc/init.d/mysqld stop echo "MySQL Server install successfully!" # configuration
cat /etc/my.cnf
sed -i '/mysqld/a\skip-grant-tables' /etc/my.cnf
systemctl restart mysqld
# mysql -u root mysql
mysql -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.cnf
sed -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/ 下载mysql

一键安装mysql的更多相关文章

  1. Centos 6.4上面用Shell脚本一键安装mysql 5.6.15

    Centos 6.4上面用Shell脚本一键安装mysql 5.6.15  #!/bin/bash if [ `uname -m` == "x86_64" ];then machi ...

  2. Rehat一键安装mysql脚本和备份数据库脚本

    Rehat一键安装mysql脚本 ##说明:适用,Rehat 5 6 7 1.运行状态,运行成功输出mysql临时密码 2.代码如下 #!/bin/bash #获取系统信息 sudo cat /etc ...

  3. 自动化运维——一键安装MySQL

    根据项目需要,前段时间在搞EMM系统各种安装包的自动化部署工作,主要包括一键安装和一键启动\停止功能.总结记录下来,以供后用. 本文主要是自动安装MySQL5.7.11版,Linux版脚本在CentO ...

  4. ubuntu上用源码进行一键安装mysql

      首先卸载原有的mysql: 首先查看自己的mysql有哪些依赖 #dpkg --list|grep mysql 先卸载 #sudo apt-get remove mysql-common #sud ...

  5. linux一键安装mysql脚本

    #!/bin/sh if [ -s /etc/my.cnf ];then rm -rf /etc/my.cnf fi echo "------------------------------ ...

  6. 【shell 每日一练7】一键安装mysql5.7,以及密码及策略修改

    一.一键安装Mysql脚本 [root@uat01 ~]# cat InstallMysql01.sh #!/bin/bash #-- #旅行者-Travel #.安装wget yum -y inst ...

  7. 转:CentOS/Debian/Ubuntu一键安装LAMP(Apache/MySQL/PHP)环境

    CentOS/Debian/Ubuntu一键安装LAMP(Apache/MySQL/PHP) 今天遇到一个网友提到需要在Linux VPS服务器中安装LAMP(Apache/MySQL/PHP)网站环 ...

  8. Centos6.5 安装MYSQL 5.5 -5.6.-5.7 一键yum快速安装 ,初始配置

    Centos6.5 安装MYSQL 5.5 ---5.6---5.7 一键yum快速安装 ,初始配置 第一步:安装mysql-5.5---- 5.6 ---- 5.7的yum源 [root@sv03 ...

  9. [svc]lnmp一键安装脚本(含有np与mysql分离)

    基于lanny一键安装包:(含lnmp所需软件及配置文件) 安装nginx: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliy ...

随机推荐

  1. gitlab hook declined错误

    在向gitlab提交工程的时候,出现错误提示: remote: GitLab: You are not allowed to access master!remote: error: hook dec ...

  2. Android之内存泄露、内存溢出、内存抖动分析

      内存   JAVA是在JVM所虚拟出的内存环境中运行的,内存分为三个区:堆.栈和方法区.栈(stack):是简单的数据结构,程序运行时系统自动分配,使用完毕后自动释放.优点:速度快.堆(heap) ...

  3. selenium webdriver如何拿到页面的加载时间

    这个问题与语言无关,对于现代浏览器来说,使用 window.performance.timing这个对象就好了. 用execute_script方法(java用executeScript)方法执行 w ...

  4. Maven 使用国内镜像

    1 修改maven 的配置文件 settings.xml,添加阿里云的一个中央仓库. 2 找到maven 的配置文件,一般在 maven 安装目录 apache-maven-3.5.0\conf 文件 ...

  5. uefi+GPT分区安装ubuntu[zz]

    现状:1.预装win8的笔记本几乎都是uefi启动模式,配合GPT磁盘分区,于是遇到了“麻烦”不会装了,或者说按照老教程安装,结果失败了.而且有很多人在问怎么解决,其实网上就有嘛,关键词就是“uefi ...

  6. windows下bash终端--git-bash总汇

    git bash是一个比较好用的终端(win下),但有一些细节需要调整后才好用. 1.比如,登陆后终端的表格,以及个别符号显示为乱码. 解决方法: 1).点击git bash左上角,选择“option ...

  7. 网页与APP中那些优美的登陆表单

    我从Dribbble收集了20个漂亮的登陆表单案例.希望你看后能从中受益,并对你以后的登陆表单设计有帮助.设计一个登陆表单是非常容易,但大多设计都很糟糕.毫无亮点.无论如何,这篇Dribbble案例集 ...

  8. FFmpeg(10)-利用FFmpeg进行视频像素格式和尺寸的转换(sws_getCachedContext(), sws_scale())

    一.包含头文件和库文件 像素格式的相关函数包含在 libswscale.so 库中,CMakeLists需要做下列改动: # swscale add_library(swscale SHARED IM ...

  9. mysql protocol

    http://hutaow.com/blog/2013/11/06/mysql-protocol-analysis/ https://dev.mysql.com/doc/internals/en/cl ...

  10. [Windows Azure] Administering your Windows Azure AD tenant

    Administering your Windows Azure AD tenant 19 out of 20 rated this helpful - Rate this topic Publish ...