MySQL社区

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
查看: 2115|回复: 2

[安装] MySQL5.7.10最新版本源代码安装详细过程

[复制链接]
发表于 2016-10-29 22:28:05 | 显示全部楼层 |阅读模式
验证环境:redhat6.5 ,虚拟环境virtualbox。
安装源码mysql之前,需要做准备工作
1、cmake的升级
原自https://typecodes.com/web/centos7compilemysql.html
所以需要下载CMake编译器、Boost库、ncurses库和GNU分析器生成器bison这4种工具。经过自己的测试发现,MySQL5.7rc编译时所需要的Boost库是boost 1.57.0版本,低于或者高于这个版本的可能会编译失败!
#######CMake编译工具[root@typecodes ~]# wget -c http://git.typecodes.com/libs/ccpp/cmake-3.2.1.tar.gz[root@typecodes ~]# tar -zxf cmake-3.2.1.tar.gz && cd cmake-3.2.1[root@typecodes cmake-3.2.1]# ./configure [root@typecodes cmake-3.2.1]# make && make install  [默认安装路径是/usr/local/bin][root@typecodes cmake-3.2.1]# cmake --version       [查看cmake版本]cmake version 3.2.1CMake suite maintained and supported by Kitware (kitware.com/cmake).[root@typecodes cmake-3.2.1]# cd ~ && rm -rf cmake-3.2.1*######也可以直接yum安装CMake2.8.11版本[root@typecodes ~]# yum -y install cmake#######Ncurses:提供功能键定义(快捷键),屏幕绘制以及基于文本终端的图形互动功能的动态库。[root@typecodes ~]# yum -y install ncurses-devel#######bison:GNU分析器生成器[root@typecodes ~]# wget -c http://git.typecodes.com/libs/ccpp/bison-3.0.tar.gz[root@typecodes ~]# tar -zxf bison-3.0.tar.gz && cd bison-3.0/ && ./configure[root@typecodes bison-3.0]# make && make install[root@typecodes bison-3.0]# cd ~ && rm -rf bison-3.0*#######Boost库:一个开源可移植的C++库,是C++标准化进程的开发引擎之一[root@typecodes ~]# wget -c http://git.typecodes.com/libs/ccpp/boost_1_57_0.tar.bz2[root@typecodes ~]# tar -jxf boost_1_57_0.tar.bz2 && cd boost_1_57_0/[root@typecodes boost_1_57_0]# ./bootstrap.sh[root@typecodes boost_1_57_0]# ./b2 stage threading=multi link=shared[root@typecodes boost_1_57_0]# ./b2 install threading=multi link=shared[root@typecodes boost_1_57_0]# cd ~ && rm -rf boost_1_57_0*


2、源码安装
原始文档:
http://dev.mysql.com/doc/refman/5.7/en/installing-source-distribution.html
[size=13.3488px][size=13.3488px][size=13.3488px] Installing MySQL Using a Standard Source Distribution


[size=13.3488px]To install MySQL from a standard source distribution:
[size=13.3488px]
[size=13.3488px]In MySQL 5.7, CMake is used as the build framework on all platforms. The instructions given here should enable you to produce a working installation. For additional information on using CMake to build MySQL, see [size=13.3488px]How to Build MySQL Server with CMake.
[size=13.3488px]If you start from a source RPM, use the following command to make a binary RPM that you can install. If you do not have rpmbuild, use rpm instead.
shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm
[size=13.3488px]The result is one or more binary RPM packages that you install as indicated in [size=13.3488px]Section 2.5.5, “Installing MySQL on Linux Using RPM Packages from Oracle”.
[size=13.3488px]The sequence for installation from a compressed tar file or Zip archive source distribution is similar to the process for installing from a generic binary distribution (see[size=13.3488px]Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”), except that it is used on all platforms and includes steps to configure and compile the distribution. For example, with a compressed tar file source distribution on Unix, the basic installation command sequence looks like this:
[size=12.6814px][size=12.6814px][size=12.6814px][url=http://dev.mysql.com/doc/refman/5.7/en/installing-source-distribution.html][/url]

# Preconfiguration setupshell> groupadd mysqlshell> useradd -r -g mysql -s /bin/false mysql# Beginning of source-build specific instructionsshell> tar zxvf mysql-VERSION.tar.gzshell> cd mysql-VERSIONshell> cmake .shell> makeshell> make install# End of source-build specific instructions# Postinstallation setupshell> cd /usr/local/mysqlshell> chown -R mysql .shell> chgrp -R mysql .shell> bin/mysql_install_db --user=mysql    # Before MySQL 5.7.6shell> bin/mysqld --initialize --user=mysql # MySQL 5.7.6 and upshell> bin/mysql_ssl_rsa_setup              # MySQL 5.7.6 and upshell> chown -R root .shell> chown -R mysql datashell> bin/mysqld_safe --user=mysql &# Next command is optionalshell> cp support-files/mysql.server /etc/init.d/mysql.server
3、 查看编译成功后的MySQL安装目录
使用命令查看MySQL的安装目录/usr/local/mysql/下面是否生成了相关目录文件(最重要的当然是bin、sbin和lib目录)
4、 启动MySQL服务
在完成上面的操作后,就可以正式使用MySQL服务了。启动MySQL进程服务的命令如下:
[color=rgb(203, 75, 22) !important][root@t mysql]# mysqld_safe --user=mysql --datadir=/mydata/mysql/data --log-error=/var/log/mysql/error.log &        [直接回车][color=rgb(220, 50, 47) !important][1] [color=rgb(220, 50, 47) !important]10274[color=rgb(220, 50, 47) !important]150513 [color=rgb(220, 50, 47) !important]21:28:16 [color=rgb(220, 50, 47) !important]mysqld_safe [color=rgb(220, 50, 47) !important]Logging [color=rgb(220, 50, 47) !important]to [color=rgb(220, 50, 47) !important]'/var/log/mysql/error.log'.[color=rgb(220, 50, 47) !important]150513 [color=rgb(220, 50, 47) !important]21:28:16 [color=rgb(220, 50, 47) !important]mysqld_safe [color=rgb(220, 50, 47) !important]Starting [color=rgb(220, 50, 47) !important]mysqld [color=rgb(220, 50, 47) !important]daemon [color=rgb(220, 50, 47) !important]with [color=rgb(220, 50, 47) !important]databases [color=rgb(220, 50, 47) !important]from [color=rgb(220, 50, 47) !important]/mydata/mysql/data[color=rgb(88, 110, 117) !important]######上面这条命令会在后台继续执行,所以直接回车并执行下面这条命令[color=rgb(220, 50, 47) !important][root@t [color=rgb(88, 110, 117) !important]# service mysqld start[color=rgb(220, 50, 47) !important]Starting [color=rgb(220, 50, 47) !important]MySQL.[color=rgb(203, 75, 22) !important][  OK  ]                 [启动成功][color=rgb(220, 50, 47) !important][root@typecodes [color=rgb(88, 110, 117) !important]#[color=rgb(88, 110, 117) !important]5、root密码需要修改[color=rgb(88, 110, 117) !important]利用mysqladmin重置密码

./bin/mysqladmin -h localhost -uroot password "root" -p'4e3taITlXU%/'--socket=/usr/local/mysql5710/mysql.sock

mysqladmin: [Warning] Using a password onthe command line interface can be insecure.

Warning: Since password will be sent toserver in plain text, use ssl connection to ensure password safety.



file:///E:/software/mysql/2015%E5%8D%9A%E5%AE%A2%E5%8D%87%E7%BA%A7%E8%AE%B0(%E5%9B%9B)%EF%BC%9ACentOS%207.1%E7%BC%96%E8%AF%91%E5%AE%89%E8%A3%85MySQL5.7.7rc%20%E2%80%94%20TypeCodes_files/mysql_success_path.png


 楼主| 发表于 2016-10-29 22:33:05 | 显示全部楼层
第一次发帖,格式有些问题。
发表于 2017-1-2 18:56:35 | 显示全部楼层
大哥,对我我这个新人来说,根本看不懂啊!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|申请友链|小黑屋|Archiver|手机版|MySQL社区 ( 京ICP备07012489号   
联系人:周生; 联系电话:13911732319

GMT+8, 2024-4-14 21:38 , Processed in 0.085284 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表