Took me a while to suffer from the first successful souce code installation of mysql-5.6.34. Just put it here and share it with u.

Env.

OS:Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Mysql: mysql-5.6.34

1. Install Cmake

[root@exadata1 cmake-3.7.1]# pwd
/root/mysql_install/cmake-3.7.1
[root@exadata1 cmake-3.7.1]# ./configure
.
.
.
-- Build files have been written to: /root/mysql_install/cmake-3.7.1
---------------------------------------------
CMake has bootstrapped.  Now run gmake.

gmake

make install

2. System configuration

2.1 add user/group
groupadd mysql
useradd -g mysql mysql

2.2 vi /etc/security/limits.conf
mysql   soft    nproc   2047
mysql   hard    nproc   16384
mysql   soft    nofile  1024
mysql   hard    nofile  65536

3. CMake config.

3.1 make sure if the package ncurses has been installed.

[root@exadata1 mysql_install]# rpm -qa ncurses
ncurses-5.5-24.20060715
ncurses-5.5-24.20060715

3.2 unzip the Mysql package.
[root@exadata1 mysql-5.7.17]# tar -zxvf mysql-5.7.17.tar.gz
[root@exadata1 mysql-5.7.17]# pwd
/root/mysql_install/mysql-5.7.17

3.3

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DENABLED_LOCAL_INFILE=ON \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DCOMPILATION_COMMENT='JSS for mysqltest' \
-DWITH_READLINE=ON \
-DSYSCONFDIR=/data/mysqldata/3306 \
-DMYSQL_UNIX_ADDR=/data/mysqldata/3306/mysql.sock

make && make install

3.4 Trouble shooting and diagnosis.
1.
-- Could NOT find Git (missing:  GIT_EXECUTABLE)

Linux下git安装配置
http://blog.csdn.net/huaishu/article/details/40891229
    tar -xzf  git-2.1.3.tar.gz  
    cd git-2.1.3  
    ./configure -prefix=/usr/local/git --with-curl  --with-expat  
    make && make install  
    
    修改/etc/profile,在PATH中加入git路径,并执行source /etc/profile
    GIT_HOME=/usr/local/git  
    PATH=$PATH:$GIT_HOME/bin:$GIT_HOME/libexec/git-core  
    export PATH GIT_HOME  
    
[root@exadata1 git-2.1.3]# . /etc/profile
[root@exadata1 git-2.1.3]# git --version
git version 2.1.3    
    
2. this can be ignored.
CMake Warning:
  Manually-specified variables were not used by the project:
    WITH_READLINE
-- Build files have been written to: /root/mysql_install/mysql-5.6.34
    

    
4. tar a package that can be deployed to any other host with similar specifications and OS.
[root@exadata1 mysql-5.6.34]# tar zcvf mysql-5.6.34.tar.gz /usr/local/mysql/

should be around 230M.

[root@exadata1 mysql-5.6.34]# ls -lht
total 230M
-rw-r--r--  1 root root  229M Dec 23 08:51 mysql-5.6.34.tar.gz

5. create Mysql DB
5.1
[root@exadata1 mysql-5.6.34]# chown -R mysql.mysql /usr/local/mysql
5.2 make dir
[root@exadata1 ~]# mkdir -p /data/mysqldata/3306/
[root@exadata1 ~]# chown -R mysql.mysql /data

bash-3.2$ id
uid=101(mysql) gid=1006(mysql) groups=1006(mysql)
bash-3.2$ mkdir -p /data/mysqldata/3306/data
bash-3.2$ mkdir -p /data/mysqldata/3306/tmp
bash-3.2$ mkdir -p /data/mysqldata/3306/binlog/mysql-bin
          mkdir -p /data/mysqldata/3306/share/english

5.3 Edit profile

vi ~/.bash_profile

export LANG=zh_CN.GB18030
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib

5.4 prepare .cnf

vi /data/mysqldata/3306/my.cnf
[client]
port = 3306
socket = /data/mysqldata/3306/mysql.sock

#The MySQL Server
[mysqld]
port = 3306
user = mysql
socket = /data/mysqldata/3306/mysql.sock
pid-file = /data/mysqldata/3306/mysql.pid
basedir = /usr/local/mysql
datadir = /data/mysqldata/3306/data
language = /data/mysqldata/3306/share/english
tmpdir = /data/mysqldata/3306/tmp
open_files_limit = 10240
explicit_defaults_for_timestamp
sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

#Buffer
max_allowed_packet = 256M
max_heap_table_size = 256M
net_buffer_length = 8k
sort_buffer_size = 2M
join_buffer_size = 4M
read_buffer_size = 2M
read_rnd_buffer_size = 16M

#Log
log-bin = /data/mysqldata/3306/binlog/mysql-bin
binlog_cache_size = 32M
max_binlog_cache_size = 512M
max_binlog_size = 512M
binlog_format = mixed
log_output = FILE
log-error = ../mysql-error.log
slow_query_log = 1
slow_query_log_file = ../slow_query.log
general_log = 0
general_log_file = ../general_query.log
expire-logs-days = 14

#InnoDB
innodb_data_file_path = ibdata1:2048M:autoextend
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_buffer_pool_size = 1024M

[mysql]
no-auto-rehash
prompt = (\u@\h)[\d]>\_
default-character-set = gbk

5.4 init mysql DB as root
/usr/local/mysql/scripts/mysql_install_db --datadir=/data/mysqldata/3306/data --basedir=/usr/local/mysql --user=mysql

/usr/local/mysql/scripts/mysql_install_db --datadir=/data/mysqldata/3306/data --basedir=/usr/local/mysql

5.5 startup DB as root
mysqld_safe --defaults-file=/data/mysqldata/3306/my.cnf &

check status:
[root@exadata1 share]# lsof -i:3306
COMMAND  PID  USER   FD   TYPE     DEVICE SIZE NODE NAME
mysqld  3779 mysql   14u  IPv6 3365226829       TCP *:mysql (LISTEN)
[root@exadata1 share]# netstat -na |grep 3306
tcp        0      0 :::3306                     :::*                        LISTEN      
unix  2      [ ACC ]     STREAM     LISTENING     3365226830 /data/mysqldata/3306/mysql.sock

2016-12-23
15:39:14 0 [Warning] The syntax '--language/-l' is deprecated and will
be removed in a future release. Please use '--lc-messages-dir' instead.
2016-12-23 15:39:14 32112 [ERROR] Can't find messagefile '/data/mysqldata/3306/share/english/errmsg.sys'

Need to copy errmsg.sys from the source package and edit my.cnf (add language parameter)
[root@exadata1 english]# cp /root/mysql_install/mysql-5.6.34/sql/share/english/errmsg.sys /data/mysqldata/3306/share/english/.

5.6 shutdown DB as root ( need mysql root password which is 'mysql123' in my case )
[root@exadata1 english]# mysqladmin -u root -p shutdown
Enter password:
161223 15:48:43 mysqld_safe mysqld from pid file /data/mysqldata/3306/mysql.pid ended
[1]+  Done                    mysqld_safe --defaults-file=/data/mysqldata/3306/my.cnf  (wd: /data/mysqldata/3306/share/english)
(wd now: ~/mysql_install/mysql-5.6.34/sql/share/english)

5.7 Add mysql into service so that it can be started when host is rebooted.
[root@exadata1 support-files]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
[root@exadata1 support-files]#

[root@exadata1 support-files]# service mysql status
MySQL running (3779)                                       [  OK  ]
[root@exadata1 support-files]# service mysql stop
Shutting down MySQL..161223 16:15:37 mysqld_safe mysqld from pid file /data/mysqldata/3306/mysql.pid ended
                                                           [  OK  ]
[1]+  Done                    mysqld_safe --defaults-file=/data/mysqldata/3306/my.cnf  (wd: /usr/local/mysql/share)
(wd now: /usr/local/mysql/support-files)
[root@exadata1 support-files]# service mysql start
Starting MySQL..                                           [  OK  ]
[root@exadata1 support-files]# service mysql status
MySQL running (5183)                                       [  OK  ]
[root@exadata1 support-files]#

5.8 log into mysql as mysql os user.
[root@exadata1 support-files]# su - mysql
-bash-3.2$
-bash-3.2$
-bash-3.2$ bash
bash-3.2$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib

export PATH

bash-3.2$ mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.34-log JSS for mysqltest

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.

(root@localhost)[(none)]>

Reference
http://www.cnblogs.com/jyzhao/p/5516031.html
http://www.cnblogs.com/Richardzhu/p/3220883.html

mysql-5.6.34 Installation from Source code的更多相关文章

  1. MySQL在linux上(cmake)的source code安装方法

    1.安装前准备: 1)必备的包和工具  gcc/g++ :MySQL 5.6开始,需要使用g++进行编译.  cmake  :MySQL 5.5开始,使用cmake进行工程管理,cmake需要2.8以 ...

  2. How to Build MySQL from Source Code on Windows & compile MySQL on win7+vs2010

    Not counting obtaining the source code, and once you have the prerequisites satisfied, [Windows] use ...

  3. 退役笔记一#MySQL = lambda sql : sql + ' Source Code 4 Explain Plan '

    Mysql 查询运行过程 大致分为4个阶段吧: 语法分析(sql_parse.cc<词法分析, 语法分析, 语义检查 >) >>sql_resolver.cc # JOIN.p ...

  4. How to build the Robotics Library from source code on Windows

    The Robotics Library is an open source C++ library for robot kinematics, motion planning and control ...

  5. How to build windows azure PowerShell Source Code

    Download any version source code of Windows Azure Powershell from https://github.com/Azure/azure-sdk ...

  6. 用source code编译安装Xdebug

    1. Unpack the tarball: tar -xzf xdebug-2.2.x.tgz.  Note that you do not need to unpack the tarball i ...

  7. 3 Ways of JDK Source Code Attachment in Eclipse---reference

    You wanna look at a JVM class while you are coding and you cannot. Here is the solution. First of al ...

  8. How to get the source code of the chromium of the specified revision

    I'd like to get the source code of the chromium 34.0.1847.9. gclient config http://src.chromium.org/ ...

  9. [转]Native Java Bytecode Debugging without Source Code

    link from:http://www.crowdstrike.com/blog/native-java-bytecode-debugging-without-source-code/index.h ...

随机推荐

  1. Android 判断一个 View 是否可见 getLocalVisibleRect(rect) 与 getGlobalVisibleRect(rect)

    Android 判断一个 View 是否可见 getLocalVisibleRect(rect) 与 getGlobalVisibleRect(rect) [TOC] 这两个方法的区别 View.ge ...

  2. 解决PHP-问题:Class 'SimpleXMLElement' not found in

    1.问题 在ubuntu 16.10中,学习PHP,学习到PHP如何生成XML文件时候,碰到了这个问题: PHP Fatal error: Class 'ClassName\SimpleXMLElem ...

  3. Android权限管理之Permission权限机制及使用

    前言: 最近突然喜欢上一句诗:"宠辱不惊,看庭前花开花落:去留无意,望天空云卷云舒." 哈哈~,这个和今天的主题无关,最近只要不学习总觉得生活中少了点什么,所以想着围绕着最近面试过 ...

  4. [.NET] C# 知识回顾 - 委托 delegate (续)

    C# 知识回顾 - 委托 delegate (续) [博主]反骨仔 [原文]http://www.cnblogs.com/liqingwen/p/6046171.html 序 上篇<C# 知识回 ...

  5. Golang 编写的图片压缩程序,质量、尺寸压缩,批量、单张压缩

    目录: 前序 效果图 简介 全部代码 前序: 接触 golang 不久,一直是边学边做,边总结,深深感到这门语言的魅力,等下要跟大家分享是最近项目 服务端 用到的图片压缩程序,我单独分离了出来,做成了 ...

  6. 前端制作动画的几种方式(css3,js)

    制作动态的网页是是前端工程师必备的技能,很好的实现动画能够极大的提高用户体验,增强交互效果,那么动画有多少实现方式,一直对此有选择恐惧症的我就总结一下,以便在开发的时候选择最好的实现方式. 1.css ...

  7. Java程序员:工作还是游戏,是该好好衡量一下了

    前阵子我终于下定决心,删掉了硬盘里所有的游戏. 身为一个程序猿,每天都要和各种新技术打交道,闲暇时间,总还得看一下各大论坛,逛逛博客园啥的,给自己充充电.游戏的话,其实我自小就比较喜欢,可以算是一种兴 ...

  8. MVC还是MVVM?或许VMVC更适合WinForm客户端

    最近开始重构一个稍嫌古老的C/S项目,原先采用的技术栈是『WinForm』+『WCF』+『EF』.相对于现在铺天盖地的B/S架构来说,看上去似乎和Win95一样古老,很多新入行的,可能就没有见过经典的 ...

  9. 定时Job在IIS中潜在危险-IIS 定期回收

    引言 有时我们会在IIS中启用一些定时服务,但是你必须清楚IIS会定期回收Asp.net的应用程序的.首先来看IIS啥时候回收APPDomain.   APPDomain 回收时机 There are ...

  10. [DS] 标记字段

    标记字段 代码中有时候有这种需求:需要一个公共访问的标记字段,以下称为标记字段. 下面是案例: 一个订单详情页面,如果页面在显示中,程序中其它地方需要访问这个"正在查看中"的订单信 ...