千家信息网

MySQL 5.7.28 源码安装

发表于:2026-11-01 作者:千家信息网编辑
千家信息网最后更新 2026年11月01日,MySQL 5.7.28 源码安装一、介绍:除了Oracle商业版数据库以外, MySQL是一款源代码开放的市面上使用率最高高的RDBMS数据库软件,采用的是GPL开源协议,自己是可以修改MySQL源
千家信息网最后更新 2026年11月01日MySQL 5.7.28 源码安装

MySQL 5.7.28 源码安装

一、介绍:

除了Oracle商业版数据库以外, MySQL是一款源代码开放的市面上使用率最高高的RDBMS数据库软件,采用的是GPL开源协议,自己是可以修改MySQL源代码用来开发自己的系统。同样也是通过最常用的SQL语句进行管理

MySQL 安装方式通常分为以下三种:

l 在线Yum安装

l 离线rpm安装

l 源码编译安装

二、安装前环境清理:

前面两种安装方式都非常简单,但是所有安装方式都共同需要遵顼以下安装前的步骤:

1) 检查是否有正在运行的MySQL进程

[root@open_source ~]# ps -ef|grep mysql |grep -v grep

2) 检查是否有正在运行的MySQL服务

6.x之前

[root@open_source ~]# chkconfig --list |grep mysql

7.x之后

[root@open_source ~]# ls -rtl /etc/init.d/mysqld [root@open_source ~]# systemctl status mysql

3) 检查和删除是否有系统自带的Mysql或mariadb

[root@open_source ~]# rpm -qa mysql[root@open_source ~]# rpm -qa mariadb

三、MySQL软件下载:

https://downloads.mysql.com/archives/community/

四、开始安装

4.1 环境准备

l 安装libaio-devel依赖包

[root@open_source ~]# yum install -y libaio-devel

4.2 创建用户及目录

l 创建用户

[root@open_source ~]# useradd -g mysql mysql

l 创建目录

 [root@open_source ~]# mkdir /mysql/3306/data

l 赋权

[root@open_source ~]# chown -R mysql.mysql /mysql

4.3 开始安装

l 解压软件

[root@open_source ~]# cd /usr/local/[root@open_source local]# tar zxf mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz

l 创建一个软连接并赋权

[root@open_source local]# ln -s mysql-5.7.28-linux-glibc2.12-x86_64 mysql[root@open_source local]# chown -R mysql.mysql mysql/

l 配置环境变量

[root@open_source local]# echo "export PATH=/usr/local/mysql/bin:$PATH" /etc/profile[root@open_source local]# source /etc/profile

l 初始化数据库

[root@open_source local]# mysqld -initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/3306/data/

l 配置My.cnf 文件

cat > /etc/my.cnf <

l 准备启动脚本

[root@open_source ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

l 启动数据库

[root@open_source ~]# /etc/init.d/mysqld start

l 登录数据库

[root@open_source ~]# mysqlWelcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 29Server version: 5.7.28-log MySQL Community Server (GPL) Copyright (c) 2000, 2019, 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>

l MySQL加固:

[root@open_source ~]# /usr/local/mysql/bin/mysql_secure_installation Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD PLUGIN can be used to test passwordsand improve security. It checks the strength of passwordand allows the users to set only those passwords which aresecure enough. Would you like to setup VALIDATE PASSWORD plugin? Press y|Y for Yes, any other key for No: 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                  file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0Please set the password for root here. New password:  Re-enter new password:  Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : yBy default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to havea user account created for them. This is intended only fortesting, and to make the installation go a bit smoother.You should remove them before moving into a productionenvironment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : ySuccess.  Normally, root should only be allowed to connect from'localhost'. This ensures that someone cannot guess atthe root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : ySuccess. By default, MySQL comes with a database named 'test' thatanyone can access. This is also intended only for testing,and should be removed before moving into a productionenvironment.  Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database...Success.  - Removing privileges on test database...Success. Reloading the privilege tables will ensure that all changesmade so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : ySuccess. All done!

l 加固后无法直接登录

[root@open_source ~]# mysqlERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

l 查看MySQL状态

mysql> mysql> show master status;+------------------+----------+--------------+------------------+-------------------------------------------+| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set                         |+------------------+----------+--------------+------------------+-------------------------------------------+| mysql-bin.000009 |     3672 |              |                  | ce8fc1bb-5fd6-11ea-869d-000c29eed638:1-20 |+------------------+----------+--------------+------------------+-------------------------------------------+1 row in set (0.00 sec) mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || bindb              || gtdb               || mdp                || mysql              || performance_schema || sys                || woo                |+--------------------+8 rows in set (0.00 sec)
数据 数据库 方式 环境 软件 检查 源码 正在 源代码 用户 目录 系统 赋权 准备 加固 登录 运行 配置 使用率 变量 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 西安纸贵互联网科技有限公司 疫情对互联网科技公司影响 美国互联网科技巨头监管 科技制造互联网公司 北京互联网科技有限公司 远拓互联网科技 科技互联网公司logo 青岛中康互联网医疗科技有限公司 科技互联网的估值 福州新华互联网科技学校 知乎 互联网科技商业 企晟互联网信息科技有限公司 徐州市互联网科技有限公司 易企秀互联网科技是做什么的 萌小萌互联网科技河南有限公司 互联网科技手机排行榜 互联网科技手抄报图片 互联网科技收购价值 唐山双旺合互联网科技产业园 恒生互联网科技趋势 互联网新科技 互联网金融公司科技 互联网科技创新企业排名 未来五年的互联网科技 银川新华互联网科技学校联系电话 互联网金融科技展 燊美集互联网科技有限公司 雨阳互联网卡科技有限公司 互联网科技年终奖 九思连强互联网电子科技有限公司
0