CentOS 6.9中如何进行二进制方式安装mysql5.7.21
发表于:2025-11-07 作者:千家信息网编辑
千家信息网最后更新 2025年11月07日,今天就跟大家聊聊有关CentOS 6.9中如何进行二进制方式安装mysql5.7.21,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。前言比 M
千家信息网最后更新 2025年11月07日CentOS 6.9中如何进行二进制方式安装mysql5.7.21
今天就跟大家聊聊有关CentOS 6.9中如何进行二进制方式安装mysql5.7.21,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。
前言
比 MySQL 5.6 快 3 倍,同时还提高了可用性,可管理性和安全性。一些重要的增强功能如下:1.性能和可扩展性: 改进 InnoDB 的可扩展性和临时表的性能,从而实现更快的网络和大数据加载等操作。2.JSON支持: 使用 MySQL 的 JSON 功能,你可以结合 NoSQL 的灵活和关系数据库的强大。3.改进复制 以提高可用性的性能。包括多源复制,多从线程增强,在线 GTIDs,和增强的半同步复制。4.性能模式 提供更好的视角。我们增加了许多新的监控功能,以减少空间和过载,使用新的 SYS 模式显著提高易用性。5.安全: 我们贯彻"安全第一"的要求,许多 MySQL 5.7 新功能帮助用户保证他们数据库的安全。6.优化: 我们重写了大部分解析器,优化器和成本模型。这提高了可维护性,可扩展性和性能。7.GIS: MySQL 5.7 全新的功能,包括 InnoDB 空间索引,使用 Boost.Geometry,同时提高完整性和标准符合性。
实验环境:VMware Workstation Pro 14(试用版)系统平台:CentOS release 6.9 (Final) 内核 2.6.32-696.el6.x86_64
1.去官网下载适合的二进制包
https://dev.mysql.com/downloads/mysql/

mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
检查系统内是否安装了数据库。
#rpm -qa|grep MariaDB#rpm -qa|grep mysql
2.创建用于启动mysql的账号和组
#getent group mysql > /dev/null || groupadd mysql#getent passwd mysql > /dev/null || useradd -g mysql -r -s /sbin/nologin mysql
3.解压包至/usr/local
#tar xvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
4.创建软链接mysql指向解压后的目录
#cd /usr/local/#ln -s mysql-5.7.21-linux-glibc2.12-x86_64/ mysql
5.修改mysql文件夹所属者和所属组
#chown -R mysql.mysql mysql/
6.添加PATH至环境变量中
#echo 'PATH=/usr/local/mysql/bin:$PATH' >> /etc/profile.d/mysql.sh检查文件#cat /etc/profile.d/mysql.sh加载环境变量文件 并检查#source /etc/profile.d/mysql.sh#echo $PATH
7.创建数据库存放文件夹和相关文件并修改权限
#mkdir -pv /data/mysqldb/3306/{logs,run,data}#touch /data/mysqldb/3306/run/mysqld.pid#touch /data/mysqldb/3306/logs/mysql-error.log#chown -R mysql.mysql /data/mysqldb/#chmod -R 770 /data/mysqldb文件没有创建的话,启动Mysql时将会报错8.修改配置文件
#vim /etc/my.cnf[client] port = 3306 socket = /var/lib/mysql/mysql.sock > 默认就是在这里[mysqld] user=mysql port = 3306 socket=/var/lib/mysql/mysql.sock basedir =/usr/local/mysqldatadir =/data/mysqldb/3306/data pid-file=/data/mysqldb/3306/run/mysqld.pid log-error=/data/mysqldb/3306/logs/mysql-error.log
9.初始化数据库
# cd /usr/local/mysql# bin/mysqld --defaults-file=/etc/my.cnf --initialize-insecure --user=mysql --datadir=/data/mysqldb/3306/dataMysql 5.7以后对密码安全有更友好的提示了,2018-03-03T15:16:23.708677Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.--initialize-insecure 以空密码初始化数据库--initialize 随机生成一个密码并显示在屏幕中,第一次登录的时候必须提供此密码。
10.复制启动服务脚本至/etc/init.d目录
#cp mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
11.添加开机启动
# chkconfig --add mysqld# chkconfig mysqld on#chkconfig --list mysqldmysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
12.启动mysql服务
#service mysqld startStarting MySQL........ [ OK ]
13.检查确认
检查3306端口是否开启
#ss -ntl | grep 3306LISTEN 0 50 *:3306 *:*
确认版本
#mysql -Vmysql Ver 14.14 Distrib 5.7.21, for linux-glibc2.12 (x86_64) using EditLine wrapper
14.进行安全配置
#/usr/local/mysql/bin/mysql_secure_installation按提示操作即可Press y|Y for Yes, any other key for No: y > 没有y就没有下一步There are three levels of password validation policy: > 列出密码要求LOW Length >= 8MEDIUM Length >= 8, numeric, mixed case, and special charactersSTRONG Length >= 8, numeric, mixed case, special characters and dictionary Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 > 选择的数字,请参考上面的密码要求Please set the password for root here.New password: > 设置密码Re-enter new password: Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y > 更新密码Remove anonymous users? (Press y|Y for Yes, any other key for No) : y > 是否移除匿名登录Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n > 是否移除远程root登录,生产环境请yRemove test database and access to it? (Press y|Y for Yes, any other key for No) : y > 是否移除test数据库,貌似二进制安装时并不包含test数据库Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y > 重新加载权限表,也就是立即生效。Success. All done!
15.客户端连接
#mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 6Server version: 5.7.21 MySQL Community Server (GPL)Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
至此,Mysql 5.7.21 二进制方式安装完毕,适合快速部署。
看完上述内容,你们对CentOS 6.9中如何进行二进制方式安装mysql5.7.21有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注行业资讯频道,感谢大家的支持。
数据
密码
数据库
文件
安全
二进制
性能
检查
功能
环境
方式
内容
可扩展性
登录
变量
可用性
同时
所属
文件夹
权限
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
c 按状态查询数据库
网络安全管理局新闻
搜题软件开发原理
表格怎么隐藏相同数据库
网络安全基本技术要点
网络安全产品效果图ps
数据库表设计范式
美安互联网科技园
私服无法连接服务器
青少年网络安全知识竞赛
做软件开发图片
网络安全演练方法
金仓数据库环境变量怎么配置
服务器emc测试是什么
枪火重生无法连接到内容服务器
数据库技术试题及答案
例举数据库查询的用途
网络技术员的日常
网络安全为人民征文500字
安恒数据库审计系统FQA
c 按状态查询数据库
蜜雪冰城软件开发
如何通过网络安全检测
临沂兰山秀目网络技术
远程用户服务器异常啥意思
c 动态创建数据库表
怎样做个小的计算软件开发
计算机网络技术网络层
gis数据地图软件开发
数据库应用技术教程必背