-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall-mysql.sh
69 lines (52 loc) · 1.81 KB
/
install-mysql.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#! /bin/shell
# Copyright 2019-2029 geekidea(https://github.com/geekidea)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#======================================================================
# 快速安装MySQL
# CentOS7 中已成功验证
# 使用yum+rpm方式安装
#
# author: geekidea
# date: 2019-8-29
#======================================================================
# 配置阿里云yum镜像源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
# 下载mysql rpm
wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
# 安装rpm
rpm -Uvh mysql80-community-release-el7-3.noarch.rpm
# yum 安装mysql服务
yum install -y mysql-community-server
# 启动mysql服务
systemctl start mysqld.service
# 查看mysql服务状态
systemctl status mysqld.service
# 查看安装的mysql密码
grep 'temporary password' /var/log/mysqld.log
TEMP_PWD=$(grep 'temporary password' /var/log/mysqld.log)
PWD=${TEMP_PWD##* }
echo "${PWD}"
# 登陆
mysql -uroot -p${PWD}
# 进入到mysql命令行时,修改密码
# 修改密码
# ALTER USER 'root'@'localhost' IDENTIFIED BY 'Springbootplus666!';
# 使用新密码登陆
# exit
# mysql -uroot -pSpringbootplus666!
# 导入spring-boot-plus数据库脚本
# use mysql;
# source /root/mysql_spring_boot_plus.sql;