SUSE Linux下源碼編譯方法裝置MySQL 5.6進程分享。本站提示廣大學習愛好者:(SUSE Linux下源碼編譯方法裝置MySQL 5.6進程分享)文章只能為提供參考,不一定能成為您想要的結果。以下是SUSE Linux下源碼編譯方法裝置MySQL 5.6進程分享正文
MySQL為開源數據庫,是以可以基於源碼完成裝置。基於源碼裝置有更多的靈巧性。也就是說我們可以針對本身的硬件平台選用適合的編譯器來優化編譯後的二進制代碼,依據分歧的軟件平台情況調劑相干的編譯參數,選擇本身須要選擇分歧的裝置組件,設定須要的字符集等等一些可以依據特定運用場景所作的各類調劑。本文描寫了若何在源碼方法下裝置MySQL。
1、裝置情況及介質
#裝置情況
SZDB:~ # cat /etc/issue
Welcome to SUSE Linux Enterprise Server 10 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 GNU/Linux
#裝置介質,可以到以下網址下載裝置介質,留意下載時選擇source code,以後版本為5.6.17
#依據你本身的情況下載響應的裝置介質,本文演示的裝置介質為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、體系需求
Source Installation System Requirements
Installation of MySQL from source requires several development tools. Some of these tools are needed no matter whether you use a standard source distribution or a development source tree. Other tool requirements depend on which installation method you use.
To install MySQL from source, your system must have the following tools, regardless of installation method:
CMake, which is used as the build framework on all platforms. CMake can be downloaded from http://www.cmake.org.
A good make program. Although some platforms come with their own make implementations, it is highly recommended that you use GNU make 3.75 or newer. It may already be available on your system as gmake. GNU make is available from http://www.gnu.org/software/make/.
A working ANSI C++ compiler. GCC 4.2.1 or later, Sun Studio 12 or later, Visual Studio 2010 or later, and many current vendor-supplied compilers are known 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.
#應用源碼裝置下面的一些開辟對象是須要的,比擬主要的一個是Cmake對象,平日情形下os並沒有裝置,須要手動裝置。
#假如沒有cmake會收到這個毛病提醒:(-bash: cmake: command not found)
3、裝置cmake
#可以到這裡下載cmake,我這裡下載的是2.6.4版本
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、裝置MySQL
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 (MESSAGE): 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 name is libncurses5-dev,
on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
cmake/readline.cmake:128 (FIND_CURSES)
cmake/readline.cmake:202 (MYSQL_USE_BUNDLED_EDITLINE)
CMakeLists.txt:411 (MYSQL_CHECK_EDITLINE)
#假如cmake時代碰著上述毛病,應當裝置ncurses-devel rpm包,然後移除CMakeCache.txt
-- Configuring incomplete, errors occurred!
#若有沒有對應的os裝置光盤,可以從上面的鏈接下載這個rpm包,留意對應的版本號應分歧
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 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 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 do 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 will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for 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.pl
New default config file was created as ./my.cnf and
will be used by default by the server when you start it.
You may edit this file to 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設置裝備擺設文件
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
#設置裝備擺設情況變量,經由過程軟鏈或許修正情況變量完成(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) 2000, 2014, 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.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)