Operating system: CentOS 6.7
MySQL version: 5.6.30
- 1. Pre-preparation
- 2. System Configuration
- 3.CMake compilation Configuration
- 4.make && make Install
- 5. Post-Configuration and testing
- Reference
1. Pre-preparation
First you need CMake, you can install Yum directly:
install cmake
can also be official website https://cmake.org/download source code compilation.
I have chosen the official website to download the latest version of cmake-3.5.2.tar.gz.
# tar -zxvf cmake-3.5.2.tar.gz && cd cmake-3.5.2# ./configure部分输出略。-- Build files have been written to: /soft/cmake-3.5.2---------------------------------------------CMake has bootstrapped. Now run gmake.# gmake # make install
2. System Configuration
To add groups and users:
groupadd mysqluseradd -g mysql mysql
The end of the vi/etc/security/limits.conf file is added:
mysql soft nproc 2047mysql hard nproc 16384mysql soft nofile 1024mysql hard nofile 65536
3.CMake compilation Configuration
Unzip the source package:
tar zxvf mysql-5.6.30.tar.gz && cd mysql-5.6.30
CMake compiling the configuration
cmake.-dcmake_install_prefix=/usr/local/mysql - Ddefault_charset=utf8 -ddefault_collation=utf8_general_ci -denabled_local_infile=on -dwith_innobase_storage_ engine=1 -dwith_federated_storage_engine=1 -DWITH_ blackhole_storage_engine=1 -dwithout_example_storage_engine=1 -dwith_partition_storage_engine=1 -DWITH_PERFSCHEMA_ storage_engine=1 -dcompilation_comment= ' JSS for Mysqltest ' -dwith_readline=on -dsysconfdir=/data/mysqldata/3306 Span class= "hljs-deletion" >-dmysql_unix_addr=/data/mysqldata/3306/mysql.sock
Encountered the following error,
--Could not find Curses (missing:curses_library curses_include_path) CMake Error at cmake/readline.cmake:85 (MESSAGE): Curses Library not found. PleaseInstall appropriatePackage, remove CMakeCache.txtand rerun CMake.On Debian/ubuntu,Packagename 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:421 (mysql_check_editline) --Configuring incomplete, Errors occurred! See also "/soft/mysql-5.6.30/cmakefiles/cmakeoutput.log". See also "/soft/mysql-5.6.30/cmakefiles/cmakeerror.log". [ [email protected] Mysql-5.6.30]#
Yum installation hints for missing packages:
install ncurses-devel
To re-delete the configuration file:
rm -rf CMakeCache.txt
Then re-cmake the tool to compile:
CMake Warning: not used by the project: WITH_READLINE-- Build files have been written to: /soft/mysql-5.6.30[[email protected] mysql-5.6.30]#
4.make && make Install
[[email protected] mysql-5.6.30]# make && make install大量输出略。
This time will be longer, but also related to machine performance.
5. Post-Configuration and Test 5.1 package MySQL binary version:
[[email protected] data]# tar zcvf mysql-5.6.30.tar.gz /usr/local/mysql/
5.2 Modify the directory owner of the MySQL software:
chown -R mysql.mysql /usr/local/mysql
5.3 Modifying the MySQL user environment variable:
VI ~/.bash_profile
export LANG=zh_CN.GB18030export PATH=/usr/local/mysql/bin:$PATH
5.4 Create a database service:
# mkdir -p /data/mysqldata/{3306/{data,tmp,binlog},backup,scripts}# chown -R mysql.mysql /data/mysqldata# su - mysql$ more /usr/local/mysql/support-files/my-default.cnf $ vi /data/mysqldata/3306/my.cnf
The contents of the MY.CNF configuration file are as follows:
[Client]port = 3306socket =/data/mysqldata/3306/mysql.sock#The MySQL server[mysqld]port = 3306user = Mysqlsocket =/data/mysqldata/3306/mysql.sockpid-file =/data/mysqldata/3306/ Mysql.pidbasedir =/usr/local/mysqldatadir =/data/mysqldata/3306/datatmpdir =/data/mysqldata/3306/tmpopen_files_ Limit = 10240explicit_defaults_for_timestampsql_mode = No_engine_substitution,strict_trans_tables#Buffermax_allowed_packet = 256mmax_heap_table_size = 256mnet_buffer_length = 8ksort_buffer_size = 2mjoin_buffer_ Size = 4mread_buffer_size = 2mread_rnd_buffer_size = 16M#Loglog-bin =/data/mysqldata/3306/binlog/mysql-binbinlog_ Cache_size = 32mmax_binlog_cache_size = 512mmax_binlog_size = 512mbinlog_format = Mixedlog_output = FILElog-error =: /mysql-error.logslow_query_log = 1slow_query_log_file =. /slow_query.loggeneral_log = 0general_log_file =. /general_query.logexpire-logs-days =#InnoDBinnodb_data_file_path = Ibdata1:2048m:autoextendinnodb_log_file_ Size = 256minnodb_log_files_in_group = 3innodb_buffer_pool_size = 1024m[mysql]no-auto-rehashprompt = (\[email protected ]\h) [\d]>\_default-character-set = GBK
Initialize MySQL database:
/usr/local/mysql/scripts/mysql_install_db --datadir=/data/mysqldata/3306/data --basedir=/usr/local/mysql
5.5 Start the database service:
mysqld_safe --defaults-file=/data/mysqldata/3306/my.cnf &
Test the connection and view the MySQL process and port listening status:
grep 3306ps -ef | grep bin/mysql | grep -v grep
The actual operation process is as follows:
[[Email protected] ~]# Su-mysql[[email protected] ~]$ mysqlwelcome to the MySQL monitor. CommandsEnd with;or \g.your MySQL connection ID is1ServerVersion5.6.30-log JSSFor Mysqltestcopyright (c)2000,, Oracleand/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporationand/or itsaffiliates. Other names trademarks of their respectiveowners. Type' Help; 'Or' \h 'For help. Type' \c ' to clear the current input statement. ([email protected]) [(none)]> exitbye[[email protected] ~]$ netstat-lnt |grep3306tcp00:::320W:::* LISTEN [[email protected] ~]$ [[email protected] ~]$ Ps-ef | grep Bin/mysql | Grep-v Grepmysql67361753011:pts/000:00:00/bin/sh/usr/local/mysql/bin/mysqld_safe--defaults-file=/data/mysqldata/3306/my.cnfmysql72026736011:pts/000:00:00/usr/local/mysql/bin/mysqld--defaults-file=/data/mysqldata/3306/my.cnf--basedir=/usr/ Local/mysql--datadir=/data/mysqldata/ 3306/data--plugin-dir=/usr/local /mysql/lib/plugin--log-error=/data/mysqldata/3306/data/. /mysql-error.log--open-files-limit=10240--pid-file=/data/ Mysqldata/3306/mysql.pid--socket=/data/mysqldata/3306/mysql.sock--port=3306
Ext.: http://www.cnblogs.com/jyzhao/p/5516031.html
MySQL starter 01-mysql source installation