SUSE Linux Source code to compile the way to install Mysql 5.6 process sharing _mysql

Source: Internet
Author: User
Tags mysql in readline

MySQL is an open source database, so it can be installed based on the source code. Source-based installation has more flexibility. In other words, we can choose the appropriate compiler for their own hardware platform to optimize the binary code after compiling, according to different software platform environment to adjust the relevant compilation parameters, choose their own needs to choose different installation components, set the required character set and so some can be made according to the specific application scenarios of various adjustments. This article describes how to install MySQL in the source mode.

1. Installation Environment and media

Copy Code code as follows:

#安装环境
szdb:~ # Cat/etc/issue
Welcome to SUSE Linux Enterprise Server SP3 (x86_64)-Kernel \ R (\l).
szdb:~ # Uname-a
Linux szdb 2.6.16.60-0.54.5-smp #1 SMP Fri Sep 4 01:28:03 UTC 2009 x86_64 x86_64 x86_64
#安装介质, you can download the installation media at the following Web site, note that the source code is selected when downloading, the current version is 5.6.17
#根据你自身的环境下载相应的安装介质, the installation media shown in this article is generic Linux (architecture independent), mysql-5.6.17.tar.gz
http://dev.mysql.com/downloads/mysql/
#源码安装方式官方网站链接: http://dev.mysql.com/doc/refman/5.6/en/installing-source-distribution.html

2, system requirements

Copy Code code as follows:

Source installation System Requirements
Installation of MySQL from source requires several development tools. Some of these tools are needed no matter whether your use a standard source distribution or a development source tree. Tool requirements depend on which installation.
To install MySQL from source, your system must have the following tools, regardless of installation method:
CMake, which is used as the "build framework" all platforms. CMake can be downloaded from http://www.cmake.org.
A Good make program. Although some platforms come with their own to make implementations, it is highly recommended this 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 are kn own to work.
Perl is needed if your intend to run test scripts. Most unix-like systems include Perl. On Windows, your can use a version such as ActiveState Perl.
#使用源码安装上面的一些开发工具是需要的, one of the more important is the CMake tool, which is usually not installed and needs to be installed manually.
#如果没有cmake会收到这个错误提示: (-bash:cmake:command not found)

3. Installation CMake

Copy Code code as follows:

#可以到这里下载cmake, I'm downloading the 2.6.4 version here.
Http://www.cmake.org/cmake/resources/software.html
szdb:~ # CD/USR/LOCAL/SRC/MYSQL_SRC
SZDB:/USR/LOCAL/SRC/MYSQL_SRC # TAR-XVF Cmake-2.6.4.tar.gz
SZDB:/USR/LOCAL/SRC/MYSQL_SRC # CD cmake-2.6.4
szdb:/usr/local/src/mysql_src/cmake-2.6.4 #./bootstrap
szdb:/usr/local/src/mysql_src/cmake-2.6.4 #./make
szdb:/usr/local/src/mysql_src/cmake-2.6.4 #./make Install

4, install MySQL

Copy Code code as follows:

szdb:~ # Groupadd MySQL
szdb:~ # useradd-r-G MySQL MySQL
szdb:~ # CD/USR/LOCAL/SRC/MYSQL_SRC
SZDB:/USR/LOCAL/SRC/MYSQL_SRC # TAR-XVF Mysql-5.6.17.tar.gz
SZDB:/USR/LOCAL/SRC/MYSQL_SRC # ls
mysql-5.6.17 mysql-5.6.17.tar.gz
SZDB:/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)
CMake Error at cmake/readline.cmake:85: Author:leshami
Curses Library not found. Please install appropriate package, Blog:http://blog.csdn.net/leshami
Remove CMakeCache.txt and rerun CMake. On Debian/ubuntu, package the name is Libncurses5-dev,
On Redhat and derivates it is ncurses-devel.
Call Stack (most recent call i):
cmake/readline.cmake:128 (find_curses)
cmake/readline.cmake:202 (Mysql_use_bundled_editline)
cmakelists.txt:411 (Mysql_check_editline)
#如果cmake期间碰到上述错误, you should install the Ncurses-devel RPM package, and then remove the 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 consistent
Http://www.filewatcher.com/m/ncurses-devel-5.5-18.11.x86_64.rpm.735840-0.html
SZDB:/USR/LOCAL/SRC/MYSQL_SRC # RPM-UVH ncurses-devel-5.5-18.11.x86_64.rpm
Preparing ... ########################################### [100%]
1:ncurses-devel ########################################### [100%]
szdb:/usr/local/src/mysql_src/mysql-5.6.17 # RM-RF CMakeCache.txt
szdb:/usr/local/src/mysql_src/mysql-5.6.17 # CMake. #再次执行cmake

........
--Library MySQLServer depends on Oslibs-lpthread;m;rt;crypt;dl;aio
--Configuring done
--Generating done
--Build the files have been written to:/usr/local/src/mysql_src/mysql-5.6.17
szdb:/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_process
szdb:/usr/local/src/mysql_src/mysql-5.6.17 # Make Install
szdb:/usr/local/src/mysql_src/mysql-5.6.17 # Cd/usr/local/mysql
Szdb:/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 and you have to copy
Support-files/mysql.server to the ' right place ' for your system

Please REMEMBER to SET A PASSWORD for the MySQL root USER!
To did so, 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_installation

Which would also give you the option of removing the test
Databases and anonymous user created by default. This is
Strongly recommended for production servers.

The manual for more instructions.

Can start the MySQL daemon with:

Cd. ;./bin/mysqld_safe &

Can test the MySQL daemon with mysql-test-run.pl

CD mysql-test; Perl mysql-test-run.pl

New Default Config file was created as./my.cnf and
'll be used by default by the server when you start 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.server #配置自启动
SZDB:/USR/LOCAL/MYSQL # CP support-files/my-default.cnf/etc/my.cnf #添加缺省的my. CNF configuration file
Szdb:/usr/local/mysql # Bin/mysqld_safe--user=mysql & #启动mysql
[1] 21004
Szdb:/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 databases From/usr/local/mysql/data
#配置环境变量, through the soft chain or modify the 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
#登陆到mysql
Szdb:/usr/local/bin # Mysql-uroot
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 1
Server version:5.6.17 Source Distribution
Copyright (c), 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark the Oracle Corporation and/or its
Affiliates. Names may trademarks of their respective
Owners.
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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.