mysqlmpp123 发表于 2016-10-29 22:28:05

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

验证环境: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编译工具# wget -c http://git.typecodes.com/libs/ccpp/cmake-3.2.1.tar.gz# tar -zxf cmake-3.2.1.tar.gz && cd cmake-3.2.1# ./configure # make && make install[默认安装路径是/usr/local/bin]# cmake --version       [查看cmake版本]cmake version 3.2.1CMake suite maintained and supported by Kitware (kitware.com/cmake).# cd ~ && rm -rf cmake-3.2.1*######也可以直接yum安装CMake2.8.11版本# yum -y install cmake#######Ncurses:提供功能键定义(快捷键),屏幕绘制以及基于文本终端的图形互动功能的动态库。# yum -y install ncurses-devel#######bison:GNU分析器生成器# wget -c http://git.typecodes.com/libs/ccpp/bison-3.0.tar.gz# tar -zxf bison-3.0.tar.gz && cd bison-3.0/ && ./configure# make && make install# cd ~ && rm -rf bison-3.0*#######Boost库:一个开源可移植的C++库,是C++标准化进程的开发引擎之一# wget -c http://git.typecodes.com/libs/ccpp/boost_1_57_0.tar.bz2# tar -jxf boost_1_57_0.tar.bz2 && cd boost_1_57_0/# ./bootstrap.sh# ./b2 stage threading=multi link=shared# ./b2 install threading=multi link=shared# cd ~ && rm -rf boost_1_57_0*


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


To install MySQL from a standard source distribution:
[*]Verify that your system satisfies the tool requirements listed at Section 2.9, “Installing MySQL from Source”.
[*]Obtain a distribution file using the instructions in Section 2.1.2, “How to Get MySQL”.
[*]Configure, build, and install the distribution using the instructions in this section.
[*]Perform postinstallation procedures using the instructions in Section 2.10, “Postinstallation Setup and Testing”.

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 How to Build MySQL Server with CMake.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.rpmThe result is one or more binary RPM packages that you install as indicated in Section 2.5.5, “Installing MySQL on Linux Using RPM Packages from Oracle”.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 (seeSection 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:

# 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进程服务的命令如下:# mysqld_safe --user=mysql --datadir=/mydata/mysql/data --log-error=/var/log/mysql/error.log &      [直接回车] 10274150513 21:28:16 mysqld_safe Logging to '/var/log/mysql/error.log'.150513 21:28:16 mysqld_safe Starting mysqld daemon with databases from /mydata/mysql/data######上面这条命令会在后台继续执行,所以直接回车并执行下面这条命令 # service mysqld startStarting MySQL.               [启动成功] #5、root密码需要修改利用mysqladmin重置密码./bin/mysqladmin -h localhost -uroot password "root" -p'4e3taITlXU%/'--socket=/usr/local/mysql5710/mysql.sockmysqladmin: 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

mysqlmpp123 发表于 2016-10-29 22:33:05

第一次发帖,格式有些问题。

阮羊 发表于 2017-1-2 18:56:35

大哥,对我我这个新人来说,根本看不懂啊!
页: [1]
查看完整版本: MySQL5.7.10最新版本源代码安装详细过程