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源码安装-记录(一)的更多相关文章

  1. mysql5.6.35源码安装记录

    mysql数据库源码安装: 源码地址:wget http://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.xx.tar.gz #安装前准备, ...

  2. centos 6.10源码安装mysql5.5.62实验

    查看系统版本 [root@ABC ~]# cat /etc/redhat-release CentOS release 6.10 (Final) 下载mysql5.5.62源码包,解压后安装 tar ...

  3. LNMP架构下的nginx、mysql、php的源码安装

    一.LNMP的介绍 LNMP就是Linux+Nginx+Mysql+Php这种网站服务架构.Linux是一类Unix计算机操作系统的统称,是目前最流行的免费操作系统,常见版本有:centos.ubun ...

  4. mysql源码安装(包括5.5和5.7)

    1.mysql5.5源码安装 yum install -y cmake ncurses-devel ncurses cd /usr/src wget -c https://cdn.mysql.com/ ...

  5. mysql5.5.30源码安装及主从搭建

    双机热备(实验环境) 主服务器:ip地址192.168.100.244,mysql版本5.5.30,源码安装 从服务器:ip地址192.168.100.245 一.源码安装mysql5.5 启动目录: ...

  6. zabbix3.4.6之源码安装

    LAMP部署环境搭建: Linux+apache(httpd)+mysql(mariadb)+php: 版本要求:apache-1.3.12,mysql-5.0.3,php-5.4.0<http ...

  7. saltstack源码安装

    环境 centos6.3,python2.7.5. 1.install libzmq-master $ git clone git://github.com/zeromq/libzmq.git $ c ...

  8. centos 7 源码安装gogs

    gogs 是轻量级的私有git 平台,允许个人通过低配置的服务器安装私有git gogs 的官网地址是:https://gogs.io/ 安装步骤 1)源码安装mysql 2)  源码安装git 3) ...

  9. maridb\mysql 源码安装,以10.1.26版本为例

    mysql 源码安装(mariadb 10.1.26) 1.环境部署 1 安装cmake 源码安装三部曲或者yum install cmake2安装依赖包yum install -y ncurses- ...

随机推荐

  1. 2.C#Panel扩展控件

    1.解决方案下添加新建项目新建类库 2. 在项目下添加新建项选择新建组件类 3.先引用,然后导入两个命名空间 4.因为是扩展控件,把继承自Component改成继承自Panel using Syste ...

  2. python 调用ldap同步密码

    windows + python2.7 安装 python-ldap https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap 2.python ...

  3. Colorful String

    Colorful String #include <bits/stdc++.h> using namespace std; typedef long long ll; ; char s[m ...

  4. mysql 优化(包含sql语句的书写)

    http://blog.chinaunix.net/uid-11640640-id-3426908.html  mysql性能优化-慢查询分析.优化索引和配置 2012-11-30 15:18:42 ...

  5. tableView的嵌套

    1,subTableView需要开启多手势识别,多层tableView都会响应滚动事件(如果底层是scroll 依然会响应,这样滚动tableview时,scroll也会滚动,导致滚动过于灵活)2,通 ...

  6. CF894B Ralph And His Magic Field

    题目链接:http://codeforces.com/contest/894/problem/B 题目大意: 往一个 \(n \times m\) 的网格中填数字 \((1 \le n,m \le 1 ...

  7. 自己写的vue底导航

    <template> <div id="app"> <div class="tabbar"> <div class=& ...

  8. SpringBoot2.1电商通用(微信+支付宝)支付系统实战

    『课程目录』: ├─第10章 全模块电商系统之商品模块 │      10-1_商品列表-上.mp4 │      10-2_商品列表-中.mp4 │      10-3_商品列表-下.mp4 │  ...

  9. Angular SPA基于Ocelot API网关与IdentityServer4的身份认证与授权(二)

    上文已经介绍了Identity Service的实现过程.今天我们继续,实现一个简单的Weather API和一个基于Ocelot的API网关. 回顾 <Angular SPA基于Ocelot ...

  10. 官网下载Java连接MySql驱动jar包

    官网地址:http://dev.mysql.com/downloads/connector/ 1.选择下载驱动 2.选择下载 3.可以不登录直接下载 4.下载下来的是zip压缩包,解压之后,文件夹中有 ...