This article mainly describes the SUSE Linux under the source code compilation method to install the MySQL 5.6 process share, this article using the SUSE Linux Enterprise Server SP3 (x86_64) system, the need for friends can refer to. MySQL is an open source database, so it can be installed based on source code. There is more flexibility in source-based installation. That is to say we can choose the right compiler for our own hardware platform to optimize the compiled binary code, according to different software platform environment to adjust the relevant compilation parameters, choose their own need to choose different installation components, set the required character set and so on some of the various adjustments can be made according to specific application scenarios. This article describes how to install MySQL in source mode.
1. Installation Environment and media
szdb:~ # Cat/etc/issuewelcome to SUSE Linux Enterprise Server SP3 (x86_64)-Kernel \ R (\l). szdb:~ # uname-alinux szdb 2.6.16.60-0.54.5-smp #1 SMP Fri Sep 4 01:28:03 UTC x86_64 x86_64 x86_64 gnu/linux# installation media, you can Download the installation media to the following URL, note that when downloading the source code, the current version is 5.6.17# according to your own environment to download the appropriate installation media, this article demonstrates the installation media is generic Linux (Architecture independent), mysql-5.6.17.tar.gzhttp://dev.mysql.com/downloads/mysql# Source Installation Method official website link: http://dev.mysql.com/doc/refman/5.6/en/ Installing-source-distribution.html
2. System Requirements
Source installation System Requirements
Installation of MySQL from source requires several development tools. Some of these tools is needed no matter whether you use a standard source distribution or a development source tree. Other tool requirements depend on which installation method.
To install MySQL from source, your system must has the following tools, regardless of installation method:cmake, which is Used as the build framework on all platforms. CMake can downloaded from Http://www.cmake.org.A good make program. Although some platforms come with their own make implementations, it's highly recommended that's use GNU make 3.75 or n Ewer. It may already is available on your system as gmake. GNU make are available from Http://www.gnu.org/software/make/.A working ANSI C + + compiler. GCC 4.2.1 or later, Sun Studio or later, Visual Studio or later, and many current vendor-supplied compilers is kn own to work. Perl is needed if you intend to run test scripts. Most unix-like systems include Perl. On Windows, you can use a version such as ActiveState Perl. #使用源码安装上面的一些开发工具是需要的, the more important one is the CMake tool, typically the OS is not installed and needs to be installed manually. #如果没有cmake会收到这个错误提示: (-bash:cmake:command not found)
3, installation CMake
#可以到这里下载cmake, I downloaded here is 2.6.4 version
http://www.cmake.org/cmake/resources/software.htmlSZDB:~ # Cd/usr/local/src/mysql_srcszdb:/usr/local/src/mysql_ SRC # TAR-XVF cmake-2.6.4.tar.gzszdb:/usr/local/src/mysql_src # CD cmake-2.6.4szdb:/usr/local/src/mysql_src/ cmake-2.6.4 #./bootstrap szdb:/usr/local/src/mysql_src/cmake-2.6.4 #/makeszdb:/usr/local/src/mysql_src/ cmake-2.6.4 #./make Install
4. Install MySQL
< Span Style= "font-family:tahoma,helvetica,arial, song body, Sans-serif; font-size:14px; line-height:25.2000007629395px ">
szdb:~ # groupadd mysqlszdb:~ # useradd-r-G MySQL mysqlszdb:~ # cd/usr/local/src/mysql_srcszdb:/usr/local/src/mysql_src # TAR-XVF mysql-5.6.17.tar.gz szdb:/usr/local/src/mysql_src # lsmysql-5.6.17 mysql-5.6.17.tar.gzszdb:/usr/local/src/ MYSQL_SRC # CD mysql-5.6.17/szdb:/usr/local/src/mysql_src/mysql-5.6.17 # CMake. ...--Check size of Wint_t-done--Could not find Curses (missing:curses_library curses_include_path) CMak E Error at cmake/readline.cmake:85 (MESSAGE): Author:leshami Curses Library is not found. Please install the appropriate package, Blog:http://blog.csdn.net/leshami remove CMakeCache.txt and rerun CMake. On Debian/ubuntu, package name was Libncurses5-dev, on Redhat and derivates it was ncurses-devel. Call Stack (most recent call first): cmake/readline.cmake:128 (find_curses) cmake/readline.cmake:202 (mysql_use_bund Led_editline) cmakelists.txt:411 (mysql_check_editline) #如果cmake期间碰到上述错误, the Ncurses-devel RPM package should be installed, then remove cmakecache.txt--configuring incomplete, Errors occurred! #如有没有对应的os安装光盘, you can download this RPM package from the link below, note that the corresponding version number should be the same as/HTTP WWW.FILEWATCHER.COM/M/NCURSES-DEVEL-5.5-18.11.X86_64.RPM.735840-0.HTMLSZDB:/USR/LOCAL/SRC/MYSQL_SRC # RPM-UVH Ncurses-devel-5.5-18.11.x86_64.rpmpreparing ########################################### [100%] 1:ncurs Es-devel ########################################### [100%]szdb:/usr/local/src/mysql_src/mysql-5.6.17 # RM-RF CM akecache.txtszdb:/usr/local/src/mysql_src/mysql-5.6.17 # CMake. #再次执行cmake ...--Library MySQLServer depends on Oslibs-lpthread;m;rt;crypt;dl;aio--Configu Ring done--generating done--Build files has been written to:/usr/local/src/mysql_src/mysql-5.6.17szdb:/usr/local /src/mysql_src/mysql-5.6.17 # Make linking CXX executable mysqltest_embedded [100%] Built target mysqltest_embedded Scanning dependencies of target my_safe_process [100%] Building CXX Object Mysql-test/lib/my/saFEPROCESS/CMAKEFILES/MY_SAFE_PROCESS.DIR/SAFE_PROCESS.CC.O linking CXX executable my_safe_process [100%] Built target my_safe_processszdb:/usr/local/src/mysql_src/mysql-5.6.17 # Make installszdb:/usr/local/src/mysql_src/ mysql-5.6.17 # cd/usr/local/mysqlszdb:/usr/local/mysql # chown-r MySQL. Szdb:/usr/local/mysql # chgrp-r MySQL. Szdb:/usr/local/mysql # scripts/mysql_install_db--user=mysql ..... To start mysqld at boot time with the to copy Support-files/mysql.server to the right place for your system please RE MEMBER to SET A PASSWORD for the MySQL root USER! To does, start the server, then issue the following commands:./bin/mysqladmin-u root password ' new-password ' ./bin/mysqladmin-u root-h szdb password ' new-password ' Alternatively you can run:./bin/mysql_secure_installa tion which would also give you the option of removing the test databases and anonymous user created by default. This is strongly recommendedFor production servers. See the Manual for more instructions.
You can start the MySQL daemon with:cd. ;./bin/mysqld_safe &you can test the MySQL daemon with mysql-test-run.pl CD mysql-test; Perl mysql-test-run.plnew Default Config file was created as./my.cnf Andwill is used by default by the server if you St Art it. You could edit this file to the change server settings .... Szdb:/usr/local/mysql # Chown-r Root. Szdb:/usr/local/mysql # chown-r MySQL data szdb:/usr/local/mysql # CP support-files/mysql.server/etc/init.d/mysql.se RVer #配置自启动SZDB:/usr/local/mysql # cp support-files/my-default.cnf/etc/my.cnf #添加缺省的my. CNF configuration file Szdb:/usr/lo Cal/mysql # Bin/mysqld_safe--user=mysql & #启动mysql [1] 21004szdb:/usr/local/mysql # 140521 02 : 54:54 mysqld_safe Logging to '/usr/local/mysql/data/szdb.err '. 140521 02:54:54 Mysqld_safe starting mysqld daemon with Da Tabases from/usr/local/mysql/data# configuration environment variables, via a soft chain or modify environment variable implementation (path= $PATH:/usr/local/mysql/bin/;export PATH) szdb:~ # LN- Fs/usr/local/mysql/bin/mysql/Usr/local/bin szdb:~ # ln-fs/usr/local/mysql/bin/mysqladmin/usr/local/bin szdb:~ # Ln-fs/usr/local/mysql/bin/mysqld _safe/usr/local/bin #登陆到mysqlSZDB:/usr/local/bin # mysql-urootwelcome to the MySQL monitor. Commands End With; or \g.your MySQL connection ID is 1Server version:5.6.17 Source distributioncopyright (c) #, Oracle and/or its a Ffiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql> show databases;+--------------------+| Database |+--------------------+| Information_schema | | MySQL | | Performance_schema | | Test |+--------------------+4 rows in Set (0.00 sec)
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
SUSE Linux Source compilation install MySQL 5.6