3分钟内快速部署MySQL5.6.35数据库

3分钟内快速部署MySQL5.6.35数据库

环境准备

[root@test mysql-5.6.35]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

1、下载软件

wget -q http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz

2、解压移动

tar xf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
mkdir -p /application
mv mysql-5.6.39-linux-glibc2.12-x86_64 /application/mysql-5.6.39
ln -s /application/mysql-5.6.39/ /application/mysql   ##此命令后期补充的
useradd -s /sbin/nologin -M mysql
chown -R mysql.mysql /application/mysql-5.6.39/
cd /application/mysql-5.6.39/

3、初始化数据库

\cp support-files/my-default.cnf /etc/my.cnf
./scripts/mysql_install_db --basedir=/application/mysql-5.6.39/ --datadir=/application/mysql-5.6.39/data/ --user=mysql
cp support-files/mysql.server /etc/init.d/mysqld
sed -i 's#/usr/local/mysql#/application/mysql-5.6.39#g' /application/mysql-5.6.39/bin/mysqld_safe /etc/init.d/mysqld

4、启动登录

/application/mysql-5.6.39/bin/mysqld_safe & 或者 /etc/init.d/mysqld start
yum install -y lsof
lsof -i :3306
PATH="/application/mysql-5.6.39/bin/:$PATH"
echo 'export PATH="/application/mysql-5.6.39/bin/:$PATH"' >> /etc/profile
source /etc/profile

5、登录测试

[root@test mysql-5.6.35]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.39 MySQL Community Server (GPL)
 
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
 
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.6.35    |
+-----------+
1 row in set (0.00 sec)
mysql> create database chengzi;
Query OK, 1 row affected (0.00 sec)
 
mysql> create database chengzi1;
Query OK, 1 row affected (0.00 sec)
 
mysql> show databases like 'cheng%';
+-------------------+
| Database (cheng%) |
+-------------------+
|chengzi            |
|chengzi1           |
+-------------------+
2 rows in set (0.00 sec)

6、配置安全策略:

[root@test mysql-5.6.39]# mysql_secure_installation
0
如无特殊说明,文章均为本站原创,转载请注明出处

该文章由 发布

这货来去如风,什么鬼都没留下!!!
发表我的评论

Hi,请填写昵称和邮箱!

取消评论
代码 贴图 加粗 链接 删除线 签到