MySQL 5.7.17源码编译安装说明

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
云数据库 RDS PostgreSQL,集群系列 2核4GB
简介:

一、系统环境


CentOS release 6.5 (Final)


Linux 2.6.32-431.el6.x86_64


最小化安装


关闭selinux, iptables,ip6tables


# yum install -y gcc-c++ readline-devel zlib-devel bison




二、安装准备

1.cmake

https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz


2.boost

https://jaist.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz


3.mysql


https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.17.tar.gz


三、preinstall


1.cmake


# cd cmake-3.7.2

# ./bootstrap 


-- Configuring done

-- Generating done

-- Build files have been written to: /home/soft/cmake-3.7.2

---------------------------------------------

CMake has bootstrapped.  Now run gmake.

# make && make install


# cmake --version

cmake version 3.7.2


CMake suite maintained and supported by Kitware (kitware.com/cmake).


2.boost

# cd /home/soft/

# tar -zxvf boost_1_59_0.tar.gz -C /usr/local

# mv boost_1_59_0 boost

# cd boost/

# ./bootstrap.sh 

# ./b2 install


四、安装mysql


user and group

# groupadd mysql

# useradd -r -g mysql -s /bin/false mysql

  

install,data,log,temp dir 

# mkdir -p /opt/mysql/data  /opt/mysql/logs /opt/mysql/temp



# vi /etc/profile  


# use for mysql 

export PATH=/opt/mysql/bin:/opt/mysql/lib:$PATH



# tar zxvf mysql-5.7.17.tar.gz

# cd mysql-5.7.17

# cmake \

-DCMAKE_INSTALL_PREFIX=/opt/mysql

-DMYSQL_UNIX_ADDR=/opt/mysql/data/mysql.sock

-DDEFAULT_CHARSET=utf8

-DDEFAULT_COLLATION=utf8_general_ci

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_ARCHIVE_STORAGE_ENGINE=1 \

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

-DWITH_MEMORY_STORAGE_ENGINE=1 \

-DWITH_READLINE=1 \

-DENABLED_LOCAL_INFILE=1 \

-DMYSQL_DATADIR=/opt/mysql/data \

-DMYSQL_USER=mysql \

-DMYSQL_TCP_PORT=3306 \

-DENABLE_DOWNLOADS=1 \

-DDOWNLOAD_BOOST=1 \

-DWITH_BOOST=/usr/local/boost



# make && make install 


# chown -R mysql:mysql /opt/mysql


编辑配置文件my.cnf

# vi /etc/my.cnf

# For advice on how to change settings please see

# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the

# *** default location during install, and will be replaced if you

# *** upgrade to a newer version of MySQL.


[mysqld]


# new add:explicit_defaults_for_timestamp

explicit_defaults_for_timestamp=true


# Remove leading # and set to the amount of RAM for the most important data

# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.

# innodb_buffer_pool_size = 128M


# Remove leading # to turn on a very important data integrity option: logging

# changes to the binary log between backups.

# log_bin


# These are commonly set, remove the # and set as required.

# basedir = .....

# datadir = .....

# port = .....

# server_id = .....

# socket = .....


# Remove leading # to set options mainly useful for reporting servers.

# The server defaults are faster for transactions and fast SELECTs.

# Adjust sizes as needed, experiment to find the optimal values.

# join_buffer_size = 128M

# sort_buffer_size = 2M

# read_rnd_buffer_size = 2M


# new add: NO_AUTO_CREATE_USER,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO



# bin/mysqld --initialize --basedir=/opt/mysql --datadir=/opt/mysql/data --user=mysql

2017-02-27T11:54:01.604788Z 0 [Warning] InnoDB: New log files created, LSN=45790

2017-02-27T11:54:01.930913Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2017-02-27T11:54:01.962973Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 6e4c012a-fce3-11e6-aa31-000c29e3a907.

2017-02-27T11:54:01.967537Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2017-02-27T11:54:01.970198Z 1 [Note] A temporary password is generated for root@localhost: Q!0+tqhgQ(iI



ADD boot item


# cp support-files/mysql.server /etc/init.d/mysqld

# chmod +x mysqld

# chmod +x /etc/init.d/mysqld 

# chkconfig --add mysqld

 



启动数据库


# /etc/init.d/mysqld start

Starting MySQL.Logging to '/opt/mysql/data/localhost.localdomain.err'.

.. SUCCESS! 

#



五、使用临时密码登录,重置root密码


# mysql -uroot -p

Enter password: (临时生成的root密码)

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 4

Server version: 5.7.17


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>  ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';


mysql> flush privileges;

Query OK, 0 rows affected (0.01 sec)


mysql> \q



本文转自 pgmia 51CTO博客,原文链接:http://blog.51cto.com/heyiyi/1707904

相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
22天前
|
关系型数据库 MySQL 数据库
Docker Compose V2 安装常用数据库MySQL+Mongo
以上内容涵盖了使用 Docker Compose 安装和管理 MySQL 和 MongoDB 的详细步骤,希望对您有所帮助。
122 42
|
1月前
|
安全 关系型数据库 MySQL
CentOS7仅安装部署MySQL80客户端
通过上述步骤,你可以在CentOS 7上成功安装并配置MySQL 8.0客户端。这个过程确保你能够使用MySQL客户端工具连接和管理远程的MySQL数据库,而不需要在本地安装MySQL服务器。定期更新MySQL客户端可以确保你使用的是最新的功能和安全修复。
206 16
|
2月前
|
关系型数据库 MySQL 数据库
【MySQL基础篇】MySQL概述、Windows下载MySQL8.0超详细图文安装教程
在这一章节,主要介绍两个部分,数据库相关概念及MySQL数据库的介绍、下载、安装、启动及连接。接着,详细描述了MySQL 8.0的版本选择与下载,推荐使用社区版(免费)。安装过程包括自定义安装路径、配置环境变量、启动和停止服务、以及客户端连接测试。此外,还提供了在同一台电脑上安装多个MySQL版本的方法及卸载步骤。最后,解释了关系型数据库(RDBMS)的特点,即基于二维表存储数据,使用SQL语言进行操作,格式统一且便于维护。通过具体的结构图展示了MySQL的数据模型,说明了数据库服务器、数据库、表和记录之间的层次关系。
【MySQL基础篇】MySQL概述、Windows下载MySQL8.0超详细图文安装教程
|
2月前
|
NoSQL 关系型数据库 Redis
《docker高级篇(大厂进阶):1.Docker复杂安装详说》包括:安装mysql主从复制、安装redis集群
《docker高级篇(大厂进阶):1.Docker复杂安装详说》包括:安装mysql主从复制、安装redis集群
137 14
|
2月前
|
关系型数据库 MySQL 数据库
docker高级篇(大厂进阶):安装mysql主从复制
docker高级篇(大厂进阶):安装mysql主从复制
131 24
|
1月前
|
关系型数据库 MySQL 应用服务中间件
《docker基础篇:8.Docker常规安装简介》包括:docker常规安装总体步骤、安装tomcat、安装mysql、安装redis
《docker基础篇:8.Docker常规安装简介》包括:docker常规安装总体步骤、安装tomcat、安装mysql、安装redis
135 7
|
2月前
|
安全 关系型数据库 MySQL
Windows Server 安装 MySQL 8.0 详细指南
安装 MySQL 需要谨慎,特别注意安全配置和权限管理。根据实际业务需求调整配置,确保数据库的性能和安全。
302 9
|
2月前
|
NoSQL 关系型数据库 MySQL
Linux安装jdk、mysql、redis
Linux安装jdk、mysql、redis
238 7
|
2月前
|
JavaScript 安全 Java
java版药品不良反应智能监测系统源码,采用SpringBoot、Vue、MySQL技术开发
基于B/S架构,采用Java、SpringBoot、Vue、MySQL等技术自主研发的ADR智能监测系统,适用于三甲医院,支持二次开发。该系统能自动监测全院患者药物不良反应,通过移动端和PC端实时反馈,提升用药安全。系统涵盖规则管理、监测报告、系统管理三大模块,确保精准、高效地处理ADR事件。
160 1
|
3月前
|
SQL 关系型数据库 MySQL
go语言数据库中mysql驱动安装
【11月更文挑战第2天】
137 4