BoomMan

爱生活,爱Coding.....

Cenos7 安装mysql5.7 专为Yang编写 -v-

手动过程


#待编写
#cd /usr/local/
cd /usr/local/
# 下载mysql源安装包
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

# 安装mysql源
yum -y localinstall mysql57-community-release-el7-8.noarch.rpm

#安装mysql-community-server
yum -y install mysql-community-server

#启动mysql服务
systemctl start mysqld

#查看是否安装成功
rpm -qa|grep mysql

#查看mysql是否启动
systemctl status mysqld

#查看临时密码
grep 'temporary password' /var/log/mysqld.log

##2018-06-08T03:35:39.937996Z 1 [Note] A temporary password is generated for root@localhost: -9IE_yDf?hyp

##登录mysql
mysql -u root -p 
-9IE_yDf?hyp

##修改密码  注意一定要复杂 mysql5.7版本认证
ALTER USER 'root'@'localhost' IDENTIFIED BY 'XXXXXXX'; 


##允许远程登录
##注意在mysql中进行配置

update mysql.user set Host='%' where HOST='localhost' and User='root';

flush privileges;

##如果还不行请配置服务器运营商的配置

脚本

1. 创建名为 mysql5.7-install-yang.sh
2. chmod +x mysql5.7-install-yang.sh

#!/bin/sh
##不完全脚本

#mysql5.7-install-yang.sh

echo "查询系统基础命令是否安装 如wget"

check_wget_results=`rpm -qa wget`

if [ "$check_wget_results" = "" ];then
echo "您的系统中没有wget,首先安装wget"
echo "现在开始安装wget"
yum -y install wget
else 
echo "wget已经安装 版本为 $check_wget_results"
fi

echo "yum源存储在/usr/local/ 目录下"
cd /usr/local/

# 下载mysql源安装包
echo "现在开始下载mysql源安装包"
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

# 安装mysql源
echo "现在开始安装yum源"
yum -y localinstall mysql57-community-release-el7-8.noarch.rpm

#安装mysql-community-server
echo "现在开始安装mysql-community-server"
yum -y install mysql-community-server

#启动mysql服务
echo "现在启动mysql服务"
systemctl start mysqld

#查看是否安装成功
echo "现在查看是否安装成功"
rpm -qa|grep mysql

#查看mysql是否启动
echo "现在查看mysql是否启动"
systemctl status mysqld

#查看临时密码
echo "现在查看临时密码"

##获取数据了临时密码串
mysql_password=$(grep 'temporary password' /var/log/mysqld.log)

##获取数据库临时密码
password=$(echo ${mysql_password#*localhost:})

##临时密码打印
echo "数据库临时密码是 $password"

半自动:

mysql -u root -p 

ALTER USER 'root'@'localhost' IDENTIFIED BY 'XXXXX';update mysql.user set Host='%' where HOST='localhost' and User='root';flush privileges;exit;
语法:https://www.cnblogs.com/handsomecui/p/5869361.html
全自动脚本:https://blog.csdn.net/offbeatmine/article/details/50925229
阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/boom_man/article/details/80620533
个人分类: Java-Web应用
想对作者说点什么? 我来说一句

centos7.1编译安装mysql5.7.7

2017年08月30日 1.06MB 下载

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭