程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> mysql5.6源碼安裝,mysql5.6源碼

mysql5.6源碼安裝,mysql5.6源碼

編輯:MySQL綜合教程

mysql5.6源碼安裝,mysql5.6源碼


1.環境介紹:

  包:mysql-5.6.24.tar.gz

  平台:centos6.5

2.安裝cmake編譯工具和依賴包:

yum install cmake -y
yum install ncurses -y
yum install bison -y
yum install gcc-c++ -y
yum install gcc -y

3.創建mysql用戶:

useradd mysql -s /sbin/nologin

4.安裝編譯mysql

  a.進入mysql安裝目錄

  b.cmake編譯:

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/var/lib/mysql -DSYSCONFDIR=/etc -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DENABLED_LOCAL_INFILE=1 -DEXTRA_CHARSETS=all -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EMBEDDED_SERVER=1 -DWITH_SSL=system

  參數說明:

    -DCMAKE_INSTALL_PREFIX:指定mysql主目錄

           -DMYSQL_DATADIR:指定數據文件存放位置

           -DSYSCONFDIR:指定my.cnf路徑

           -DMYSQL_UNIX_ADDR:指定連接數據庫socket文件路徑

        -DENABLED_LOCAL_INFILE=1:允許從本地導入數據

        -DEXTRA_CHARSETS=all:安裝所有的字符集

        -DDEFAULT_CHARSET=utf8:指定默認字符

        -DWITH_PARTITION_STORAGE_ENGINE=1:安裝支持數據庫分區

  c.gmake

  d.make install

5.cp相關文件和修改參數:

  a.拷貝

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

  b.修改參數(創建目錄:mkdir /var/lib/mysql):

[client]
port = 53307
socket = /usr/local/mysql/mysql.sock

[mysql]
no-auto-rehash

[mysqld]
user = mysql
port = 53307
socket = /usr/local/mysql/mysql.sock
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
open_files_limit=10240

back_log = 600   
max_connections = 3000   
max_connect_errors = 6000   
table_open_cache = 4096
external-locking = FALSE  
max_allowed_packet = 32M  
sort_buffer_size = 2M  
join_buffer_size = 2M   
thread_cache_size = 300   
thread_concurrency = 8   
query_cache_size = 64M   
query_cache_limit = 4M    
query_cache_min_res_unit = 2k    
default-storage-engine = MyISAM
thread_stack = 192K  
transaction_isolation = READ-COMMITTED   
tmp_table_size = 256M
max_heap_table_size = 256M

slow-query-log=0
slow_query_log_file=/usr/local/mysql/slow-log.log
long_query_time=2

log-bin
binlog_cache_size = 4M
max_binlog_cache_size = 8M
max_binlog_size = 512M

expire_logs_days = 7
key_buffer_size = 2048M 
read_buffer_size = 1M  
read_rnd_buffer_size = 16M   
bulk_insert_buffer_size = 64M   
myisam_sort_buffer_size = 128M   
myisam_max_sort_file_size = 10G   
myisam_repair_threads = 1   
myisam_recover   
skip-name-resolve
lower_case_table_names = 1

[mysqldump]
quick
max_allowed_packet = 32M

[mysqld_safe]
log-error=/usr/local/mysql/mysql_oldboy.err
pid-file=/usr/local/mysql/mysqld.pid

6.修改環境變量:

vim .bash_profile

PATH=$PATH:$HOME/bin:/usr/local/mysql/bin

 7.運行mysql_install_db文件:

./mysql_install_db --basedir=/usr/local/mysql/ --datadir=/var/lib/mysql/ --no-default --user=mysql

8.啟動mysql服務:

service mysql start

9.查看mysql進程:

ps –ef|grep mysql

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved