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- ...
随机推荐
- (Python基础教程之十二)Python读写CSV文件
Python基础教程 在SublimeEditor中配置Python环境 Python代码中添加注释 Python中的变量的使用 Python中的数据类型 Python中的关键字 Python字符串操 ...
- mac下charles使用
设置charles 电脑上一次性的工作 1 下载下面两个文件(这里版本自己定) a charles-proxy-4.1.4.dmg b charles4.1.4的副本.jar 2 进行charles ...
- sound of the genuine
“There is something in every one of you that waits and listens for the sound of the genuine in yours ...
- 系列13 docker asp.net core部署
一.介绍 本篇完整介绍asp.net core web api如何部署到docker容器中,并通过外部访问web api服务.在编写完成dockerfile之后,可以通过docker [image ...
- mouseover与mouseenter区别
学习笔记. mouseover:在鼠标移入元素本身或者子元素时都会触发事件,相当于有一个冒泡过程.而且在鼠标移入子元素中时,父元素会显示离开的状态:相应的,当鼠标从子元素移入父元素,子元素也会显示离开 ...
- 王艳 201771010127《面向对象程序设计(java)》第六周学习总结
实验六 继承定义与使用 一:理论部分: 第五章:继承类. 1.继承:已有类来构建新类的一种机制.档定义了一个新类继承另一个类时,这个新类就继承了这个类的方法和域,同时在新类中添加新的方法和域以适应新的 ...
- 201771010128 王玉兰《面象对象程序设计(Java)》第六周学习总结
第一部分:基础知识总结: 1.继承 A:用已有类来构建新类的一种机制,当定义了一个新类继承一个类时,这个新类就继承了这个类的方法和域以适应新的情况: B:特点:具有层次结构.子类继承父类的方法和域: ...
- POJ1015
题目链接:http://poj.org/problem?id=1015 大概题意: 法庭要挑选m人陪审团.先随机挑选n个公民,对于每个公民,控辩双方都有各自的“喜好度”p[ ] 和 d[ ],法庭要尽 ...
- PHP设计模式(一)
1)工厂模式 工厂模式是用工厂方法生成对象,而不是直接new一个对象.假设我们在Config命名空间下有一个名叫Db的数据库操作类,用普通的方法,如果我们想去创建一个Db的对象,我们会直接new一个出 ...
- 解释一下,@SpringBootApplication
解释一下,@SpringBootApplication其实就是以下三个注解的总和 @Configuration: 用于定义一个配置类 @EnableAutoConfiguration :Spring ...