mysql基础-新版5.7.10源码安装-记录(一)
0x01
MySQL 从 5.5 版本开始,通过 ./configure 进行编译配置方式已经被取消,取而代之的是 cmake 工具
引用一句话
cmake的重要特性之一是其独立于源码(out-of-source)的编译功能,即编译工作可以在另一个指定的目录中而非源码目录中进行,这可以保证源码目录不受任何一次编译的影响,因此在同一个源码树上可以进行多次不同的编译,如针对于不同平台编译。
所以首先要安装cmake 可以源码安装也可以 使用已经编译好的rpm包进行安装
yum安装 yum install cmake -y
源码安装 下载源码 wget --no-check-certificate https://www.cmake.org/files/v3.4/cmake-3.4.1.tar.gz
解压 cmake tar -zxvf cmake-3.4.1.tar.gz
编译安装 ./configure --prefix=/usr/local/cmake make && make install
做个软链接 ln -s /usr/local/cmake/bin/cmake /usr/bin/cmake
执行 cmake --help 成功!
0x02
开始安装源码mysql
在搜狐的镜像下载源码
wget -c http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.10.tar.gz
解压源码包
tar -zxvf mysql-5.7.10.tar.gz
根据自己的要求选择需要编译的模块
建立mysql安装目录及数据存放的目录
mkdir /usr/local/mysql ----安装文件的目录
mkdir /mydata/mysql/log ----二进制日志目录,做主从同步使用
mkdir /mydata/mysql/data ----数据库数据目录 PS:数据目录一定不要和mysql程序安装目录放在一起
创建mysql 用户和组
groupadd -r -g 306 mysql ---创建一个mysql组指定gid 为306 -r是创建为一个系统用户
useradd -g mysql -u 306 -r -s /sbin/nologin mysql ---创建用户mysql 指定uid 为306 shell为非登录shell的系统用户 归属mysql组
开始编译安装 ,但是报错 如下

进行下载对应包即可
wget -c http://www.sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
解压到指定文件并改名
tar -zxvf boost_1_59_0.tar.gz -C /tmp
mv /tmp/boost_1_59 /usr/local/boost
再编译安装
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/mydata/mysql/data -DSYSCONFDIR=/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_LIBWRAP=0 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_BOOST=/usr/local/boost
上面编译完成 make 过程曲折,一直过不去,后来根据大神经验
http://www.lengdo.com/blog/view/id/52.html
http://blog.csdn.net/mchdba/article/details/50354213
发现非常好用内存,故 更改测试环境虚拟机内存至 4 G 才解决
后面make install 很顺利,完成mysql源码安装
下面开始初始化准备工作:如下
更改安装好的mysql路径下的文件拥有组
chown -R :mysql /usr/local/mysql/

更改mysql的数据目录和日志目录拥有人和拥有组

创建目录 mkdir /var/run/mysql

复制默认配置文件到对应目录
cp support-files/my-default.cnf /etc/my.cnf
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. # The following options will be passed to all MySQL clients
[client]
port =
socket = /tmp/mysql.sock # The MySQL server
[mysqld]
table_open_cache =
max_allowed_packet = 16M
myisam_repair_threads =
myisam_sort_buffer_size = 8M # File Path
pid-file = /var/run/mysql/mysql.pid
#log-error = /var/log/mysql/error.log
log-error = /mydata/mysql/log/error.log # Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at % of total RAM for dedicated server, else %.
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
log-bin = /mydata/mysql/log/mysql-bin # These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
datadir = /mydata/mysql/data
# port = .....
# server_id = .....
# socket = ..... # binary logging format - mixed recommended
binlog_format = mixed # required unique id between and ^ -
# defaults to if master-host is not set
# but will not function as a master if omitted
server-id = # 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
key_buffer_size = 16M
read_buffer_size = 2M
sort_buffer_size = 2M
join_buffer_size = 16M
read_rnd_buffer_size = 2M # Other Switch Settings
performance_schema = OFF # Recommended in standard MySQL setup
sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [mysqldump]
quick
max_allowed_packet = 16M [myisamchk]
read_buffer = 2M
write_buffer = 2M
key_buffer_size = 20M
sort_buffer_size = 20M
开始初始化
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/mydata/mysql/data/

初始化密码是 g2gd_/0y0,+I
复制mysql的自动启停脚本
cp support-files/mysql.server /etc/init.d/mysql
将mysql服务添加到管理服务中,让其开机启动
chkconfig --add mysqld
chkconfig --list | grep mysqld
启动mysql

使用刚才上面生成密码 进入mysql

登录成功,迅速修改root密码
alter user 'root'@'localhost' identified by 'your password';
flush privileges;
将mysql客户端设置环境变量,让其正常使用
通过 如下添加mysql.sh
vim /etc/profile.d/mysql.sh ---- 添加 ----> export PATH=/usr/local/mysql/bin:$PATH
让其生效
source /etc/profile.d/mysql.sh
mysql基础-新版5.7.10源码安装-记录(一)的更多相关文章
- mysql5.6.35源码安装记录
mysql数据库源码安装: 源码地址:wget http://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.xx.tar.gz #安装前准备, ...
- centos 6.10源码安装mysql5.5.62实验
查看系统版本 [root@ABC ~]# cat /etc/redhat-release CentOS release 6.10 (Final) 下载mysql5.5.62源码包,解压后安装 tar ...
- LNMP架构下的nginx、mysql、php的源码安装
一.LNMP的介绍 LNMP就是Linux+Nginx+Mysql+Php这种网站服务架构.Linux是一类Unix计算机操作系统的统称,是目前最流行的免费操作系统,常见版本有:centos.ubun ...
- mysql源码安装(包括5.5和5.7)
1.mysql5.5源码安装 yum install -y cmake ncurses-devel ncurses cd /usr/src wget -c https://cdn.mysql.com/ ...
- mysql5.5.30源码安装及主从搭建
双机热备(实验环境) 主服务器:ip地址192.168.100.244,mysql版本5.5.30,源码安装 从服务器:ip地址192.168.100.245 一.源码安装mysql5.5 启动目录: ...
- zabbix3.4.6之源码安装
LAMP部署环境搭建: Linux+apache(httpd)+mysql(mariadb)+php: 版本要求:apache-1.3.12,mysql-5.0.3,php-5.4.0<http ...
- saltstack源码安装
环境 centos6.3,python2.7.5. 1.install libzmq-master $ git clone git://github.com/zeromq/libzmq.git $ c ...
- centos 7 源码安装gogs
gogs 是轻量级的私有git 平台,允许个人通过低配置的服务器安装私有git gogs 的官网地址是:https://gogs.io/ 安装步骤 1)源码安装mysql 2) 源码安装git 3) ...
- maridb\mysql 源码安装,以10.1.26版本为例
mysql 源码安装(mariadb 10.1.26) 1.环境部署 1 安装cmake 源码安装三部曲或者yum install cmake2安装依赖包yum install -y ncurses- ...
随机推荐
- 【Jmeter学习】【第一节】【Jmeter的安装】
转载至https://www.cnblogs.com/qinlangsky/p/11941230.html 写的非常详细
- spark机器学习从0到1特征抽取–Word2Vec(十四)
一.概念 Word2vec是一个Estimator,它采用一系列代表文档的词语来训练word2vecmodel.该模型将每个词语映射到一个固定大小的向量.word2vecmodel使用文档中每个词 ...
- [Unity3D]编辑器扩展之数组或List显示
效果如下: 源码如下: using System.Collections.Generic; using UnityEditor; using UnityEngine; namespace XM.Edi ...
- Django视图函数函数之视图装饰器
FBV模式装饰器: 普通函数的装饰器(语法糖@) views.py from django.shortcuts import render def wrapper(f): def inner(*arg ...
- mysql小白系列_10 mysql主从复制原理
1.如何解决主从复制延迟的问题? (1)主从复制原理 http://www.cnblogs.com/jenvid/p/8410922.html 1.salve执行slave start,salve服务 ...
- 网页导出成word文档的默认视图方式问题
网页导出成word文档的默认视图方式问题 一般保存后的word文档默认是“Web版式视图”打开,这样会给客户的感觉不是真正的word文档,必须实现打开就是“页面视图” 1. 修改<html> ...
- JavaScript(对象的创建模式)
JavaScript和其他语言略有不同,在JavaScript中,引用数据类型都是对象(包括函数).不过,在JavaScript中并没有“类”的概念,这决定了在JavaScript中不能直接来定义“类 ...
- poj1699 KMP+壮压DP
Best Sequence Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 6338 Accepted: 2461 Des ...
- poj3683 2-SAT 同上一道
Priest John's Busiest Day Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10151 Accep ...
- springboot中yml常用配置
server: port: 8080 spring: datasource: #数据源配置 driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc: ...